2
0
mirror of https://github.com/iconify/iconify.git synced 2025-01-23 23:28:25 +00:00
iconify/packages/utils/tests/get-icon-test.ts

72 lines
1.0 KiB
TypeScript
Raw Normal View History

import { getIconData } from '../lib/icon-set/get-icon';
describe('Testing getting icon data', () => {
2021-09-20 23:53:49 +03:00
test('Simple icon', () => {
const result = getIconData(
{
prefix: 'foo',
icons: {
bar: {
body: '<g />',
width: 24,
},
},
},
'bar'
);
expect(result).toEqual({
body: '<g />',
width: 24,
});
});
2021-05-27 19:52:31 +03:00
2021-09-20 23:53:49 +03:00
test('Minified icon set', () => {
const result = getIconData(
2021-05-27 19:52:31 +03:00
{
prefix: 'test_set',
2021-05-27 19:52:31 +03:00
icons: {
test_icon: {
2021-05-27 19:52:31 +03:00
body: '<g />',
},
},
width: 24,
height: 24,
},
'test_icon'
);
expect(result).toEqual({
body: '<g />',
width: 24,
height: 24,
});
});
test('Alias', () => {
const result = getIconData(
{
prefix: 'test_set',
icons: {
test_icon: {
body: '<g />',
},
},
aliases: {
test_alias: {
parent: 'test_icon',
rotate: 2,
},
},
width: 24,
height: 24,
},
'test_alias'
2021-05-27 19:52:31 +03:00
);
expect(result).toEqual({
2021-05-27 19:52:31 +03:00
body: '<g />',
width: 24,
height: 24,
rotate: 2,
2021-05-27 19:52:31 +03:00
});
});
});