-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathsarifLoader.test.js
More file actions
43 lines (37 loc) · 1.44 KB
/
sarifLoader.test.js
File metadata and controls
43 lines (37 loc) · 1.44 KB
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
41
42
43
"use strict";
const sarifLoader = require('./sarifLoader');
test('sarifLoader should better load test001 and retrieve version', async () => {
const sarifs = await sarifLoader.load('./fixtures/test001.sarif');
expect(sarifs.length).toEqual(1);
for (const sarif of sarifs) {
expect(sarif.version).toEqual('2.1.0');
}
});
test('sarifLoader should better load fixtures directory and retrieve versions from each file', async () => {
const sarifs = await sarifLoader.load('./fixtures');
expect(sarifs.length).toEqual(9);
for (const sarif of sarifs) {
expect(sarif.version).toEqual('2.1.0');
}
});
test('sarifLoader should better load fixtures directory with trailing slash and retrieve versions from each file', async () => {
const sarifs = await sarifLoader.load('./fixtures/');
expect(sarifs.length).toEqual(9);
for (const sarif of sarifs) {
expect(sarif.version).toEqual('2.1.0');
}
});
test('sarifLoader should better load fixtures via glob', async () => {
const sarifs = await sarifLoader.load('./fixtures/subdir_test/*.json');
expect(sarifs.length).toEqual(2);
for (const sarif of sarifs) {
expect(sarif.version).toEqual('2.1.0');
}
});
test('sarifLoader should better load fixtures via glob with directory wildcard', async () => {
const sarifs = await sarifLoader.load('./fixtures/**/*.json');
expect(sarifs.length).toEqual(2);
for (const sarif of sarifs) {
expect(sarif.version).toEqual('2.1.0');
}
});