2
0
mirror of https://github.com/iconify/iconify.git synced 2024-12-12 13:47:49 +00:00

Move fixtures in utils to fixtures directory

This commit is contained in:
Vjacheslav Trushkin 2022-01-09 22:44:48 +02:00
parent 3d1a89ef77
commit ba633df0c8
3 changed files with 26 additions and 13 deletions

View File

@ -1,14 +1,20 @@
import { FileSystemIconLoader } from '../lib';
describe('Testing FileSystemIconLoader', () => {
test('FileSystemIconLoader', async() => {
const result = await FileSystemIconLoader(__dirname)('circle')
test('FileSystemIconLoader', async () => {
const result = await FileSystemIconLoader(__dirname + '/fixtures')(
'circle'
);
expect(result && result.indexOf('svg') > -1).toBeTruthy();
});
test('FileSystemIconLoader with transform', async() => {
const result = await FileSystemIconLoader(__dirname, (icon) => {
return icon.replace('<svg ', '<svg width="1em" height="1em" ')
})('circle')
test('FileSystemIconLoader with transform', async () => {
const result = await FileSystemIconLoader(
__dirname + '/fixtures',
(icon) => {
return icon.replace('<svg ', '<svg width="1em" height="1em" ');
}
)('circle');
expect(result && result.indexOf('width="1em"') > -1).toBeTruthy();
expect(result && result.indexOf('height="1em"') > -1).toBeTruthy();
});

View File

Before

Width:  |  Height:  |  Size: 101 B

After

Width:  |  Height:  |  Size: 101 B

View File

@ -1,16 +1,23 @@
import { getCustomIcon } from '../lib';
const svg = '<svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"><circle cx="60" cy="60" r="50"/></svg>'
const svg =
'<svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"><circle cx="60" cy="60" r="50"/></svg>';
describe('Testing getCustomIcon', () => {
test('CustomIconLoader', async() => {
const result = await getCustomIcon(() => svg, 'a', 'b')
test('CustomIconLoader', async () => {
const result = await getCustomIcon(() => svg, 'a', 'b');
expect(svg).toEqual(result);
});
test('CustomIconLoader with transform', async() => {
const result = await getCustomIcon(() => svg, 'a', 'b', (icon) => {
return icon.replace('<svg ', '<svg width="1em" height="1em" ')
})
test('CustomIconLoader with transform', async () => {
const result = await getCustomIcon(
() => svg,
'a',
'b',
(icon) => {
return icon.replace('<svg ', '<svg width="1em" height="1em" ');
}
);
expect(result && result.indexOf('width="1em"') > -1).toBeTruthy();
expect(result && result.indexOf('height="1em"') > -1).toBeTruthy();
});