2
0
mirror of https://github.com/iconify/iconify.git synced 2024-11-17 18:15:09 +00:00
iconify/packages/utils/tests/file-system-icon-test.ts

26 lines
919 B
TypeScript
Raw Normal View History

import { FileSystemIconLoader } from '../lib/loader/node-loaders';
const fixturesDir = './tests/fixtures';
describe('Testing FileSystemIconLoader', () => {
test('FileSystemIconLoader', async () => {
2022-03-14 14:39:40 +00:00
const result = await FileSystemIconLoader(fixturesDir)('circle');
expect(result && result.indexOf('svg') > -1).toBeTruthy();
});
2022-06-17 20:10:54 +00:00
test('FileSystemIconLoader cleanups svg preface', async () => {
const result = await FileSystemIconLoader(fixturesDir)(
'circle-xml-preface'
);
expect(result && result.indexOf('<svg') === 0).toBeTruthy();
});
test('FileSystemIconLoader with transform', async () => {
2022-03-14 14:39:40 +00:00
const result = await FileSystemIconLoader(fixturesDir, (icon) => {
return icon.replace(/<svg\s+/, '<svg width="1em" height="1em" ');
2022-03-14 14:39:40 +00:00
})('circle');
expect(result && result.indexOf('width="1em"') > -1).toBeTruthy();
expect(result && result.indexOf('height="1em"') > -1).toBeTruthy();
});
});