Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit c465dfb

Browse files
committed
Add test case for scan with annotations not set
1 parent 950edef commit c465dfb

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

hooks/declarative-subsequent-scans/hook.test.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,41 @@ test("should not start scan when the cascadingrule for it is already in the chai
173173

174174
expect(cascadedScans).toMatchInlineSnapshot(`Array []`);
175175
});
176+
177+
test("should not crash when the annotations are not set", () => {
178+
parentScan.metadata.annotations = undefined;
179+
180+
const findings = [
181+
{
182+
name: "Port 443 is open",
183+
category: "Open Port",
184+
attributes: {
185+
state: "open",
186+
hostname: "foobar.com",
187+
port: 443,
188+
service: "https",
189+
},
190+
},
191+
];
192+
193+
const cascadedScans = getCascadingScans(
194+
parentScan,
195+
findings,
196+
sslyzeCascadingRules
197+
);
198+
199+
expect(cascadedScans).toMatchInlineSnapshot(`
200+
Array [
201+
Object {
202+
"cascades": null,
203+
"generatedBy": "tls-scans",
204+
"name": "sslyze-foobar.com-tls-scans",
205+
"parameters": Array [
206+
"--regular",
207+
"foobar.com:443",
208+
],
209+
"scanType": "sslyze",
210+
},
211+
]
212+
`);
213+
});

0 commit comments

Comments
 (0)