-
Notifications
You must be signed in to change notification settings - Fork 182
Expand file tree
/
Copy pathparser.test.js
More file actions
55 lines (49 loc) · 1.56 KB
/
Copy pathparser.test.js
File metadata and controls
55 lines (49 loc) · 1.56 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
44
45
46
47
48
49
50
51
52
53
54
55
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
import { readFile } from "fs/promises";
import { validateParser } from "@securecodebox/parser-sdk-nodejs/parser-utils";
import { parse } from "./parser";
test("parses www.securecodebox.io result file into findings", async () => {
const fileContent = await readFile(
__dirname + "/__testFiles__/docs.securecodebox.io.json",
{
encoding: "utf8",
},
);
const findings = await parse(fileContent);
expect(validateParser(findings)).toBeUndefined();
expect(findings).toMatchSnapshot();
});
test("parses OWASP Juice Shop result file into findings", async () => {
const fileContent = await readFile(
__dirname + "/__testFiles__/juice-shop.json",
{
encoding: "utf8",
},
);
const findings = await parse(fileContent);
expect(validateParser(findings)).toBeUndefined();
expect(findings).toMatchSnapshot();
});
test("should properly parse empty json file", async () => {
const fileContent = await readFile(
__dirname + "/__testFiles__/empty-report.json",
{
encoding: "utf8",
},
);
const findings = await parse(fileContent);
expect(validateParser(findings)).toBeUndefined();
expect(findings).toMatchInlineSnapshot(`[]`);
});
test("parses 'no web server found' finding correctly", async () => {
const fileContent = await readFile(
__dirname + "/__testFiles__/unresolvable-host.json",
{
encoding: "utf8",
},
);
const findings = await parse(fileContent);
expect(validateParser(findings)).toBeUndefined();
});