-
Notifications
You must be signed in to change notification settings - Fork 650
Expand file tree
/
Copy pathis-snap-icon.test.ts
More file actions
40 lines (31 loc) · 993 Bytes
/
is-snap-icon.test.ts
File metadata and controls
40 lines (31 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import assert from 'assert';
import { isSnapIcon } from './is-snap-icon';
import { VirtualFile } from '../../virtual-file';
describe('isSnapIcon', () => {
it('does nothing on valid icon', async () => {
const svgIcon = new VirtualFile({
value: '<svg></svg>',
path: '/icon.svg',
});
const report = jest.fn();
assert(isSnapIcon.structureCheck);
await isSnapIcon.structureCheck(
{ svgIcon, localizationFiles: [], auxiliaryFiles: [] },
{ report },
);
expect(report).toHaveBeenCalledTimes(0);
});
it('reports on invalid icon', async () => {
const svgIcon = new VirtualFile({ value: 'foobar', path: './icon.svg' });
const report = jest.fn();
assert(isSnapIcon.structureCheck);
await isSnapIcon.structureCheck(
{ svgIcon, localizationFiles: [], auxiliaryFiles: [] },
{ report },
);
expect(report).toHaveBeenCalledWith(
'is-snap-icon',
'Snap icon must be a valid SVG.',
);
});
});