Allow duplicate categories in the same validation step

A single SARIF file should be allowed to have duplicated
categories.
This commit is contained in:
Andrew Eisenberg 2022-01-12 16:32:09 -08:00
parent 8454e21c9c
commit ab1f709732
6 changed files with 23 additions and 4 deletions

View file

@ -184,8 +184,10 @@ ava_1.default.beforeEach(() => {
(0, ava_1.default)("validateUniqueCategory for multiple runs", (t) => {
const sarif1 = createMockSarif("abc", "def");
const sarif2 = createMockSarif("ghi", "jkl");
const multiSarif = { runs: [sarif1.runs[0], sarif2.runs[0]] };
// duplicate categories are allowed within the same sarif file
const multiSarif = { runs: [sarif1.runs[0], sarif1.runs[0], sarif2.runs[0]] };
t.notThrows(() => uploadLib.validateUniqueCategory(multiSarif));
// should throw if there are duplicate categories in separate validations
t.throws(() => uploadLib.validateUniqueCategory(sarif1));
t.throws(() => uploadLib.validateUniqueCategory(sarif2));
});