Skip to content

Commit

Permalink
fix: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tjsilver committed Oct 9, 2024
1 parent 8e91c58 commit 0a8ac3c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/repocop/src/evaluation/repository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ const oldCriticalDependabotVuln: RepocopVulnerability = {
alert_issue_date: new Date('2021-01-01T00:00:00.000Z'),
is_patchable: true,
cves: ['CVE-2021-1234'],
within_sla: false,
};

const newCriticalDependabotVuln: RepocopVulnerability = {
Expand Down Expand Up @@ -922,6 +923,7 @@ describe('NO RULE - Vulnerabilities from Dependabot', () => {
alert_issue_date: new Date('2022-06-15T07:43:03Z'),
is_patchable: true,
cves: ['CVE-2018-6188'],
within_sla: false,
};

const expected2: RepocopVulnerability = {
Expand All @@ -939,6 +941,7 @@ describe('NO RULE - Vulnerabilities from Dependabot', () => {
alert_issue_date: new Date('2022-06-14T15:21:52Z'),
is_patchable: true,
cves: ['CVE-2021-20191'],
within_sla: false,
};

expect(result).toStrictEqual([expected1, expected2]);
Expand Down Expand Up @@ -973,6 +976,7 @@ describe('NO RULE - Vulnerabilities from Snyk', () => {
alert_issue_date: new Date('2020-01-01'),
is_patchable: true,
cves: ['CVE-1234'],
within_sla: false,
});
});

Expand All @@ -998,6 +1002,7 @@ describe('Deduplication of repocop vulnerabilities', () => {
alert_issue_date: new Date('2022-06-15T07:43:03Z'),
is_patchable: true,
cves: ['CVE-2018-6188'],
within_sla: false,
};
const vuln2: RepocopVulnerability = {
full_name: fullName,
Expand All @@ -1010,6 +1015,7 @@ describe('Deduplication of repocop vulnerabilities', () => {
alert_issue_date: new Date('2022-06-15T07:43:03Z'),
is_patchable: true,
cves: ['CVE-2018-6188'],
within_sla: false,
};
const actual = deduplicateVulnerabilitiesByCve([vuln1, vuln2]);
test('Should happen if two vulnerabilities share the same CVEs', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const highRecentVuln: RepocopVulnerability = {
alert_issue_date: new Date(),
is_patchable: true,
cves: ['CVE-123'],
within_sla: true,
};

describe('createDigest', () => {
Expand Down Expand Up @@ -150,6 +151,7 @@ describe('createDigest', () => {
alert_issue_date: new Date(),
is_patchable: true,
cves: ['CVE-123'],
within_sla: true,
};
const anotherResultWithVuln: EvaluationResult = {
...anotherResult,
Expand Down
1 change: 1 addition & 0 deletions packages/repocop/src/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ describe('vulnSortingPredicate', () => {
source: 'Dependabot',
alert_issue_date: new Date(),
cves: [],
within_sla: true,
};
const criticalNotPatchable: RepocopVulnerability = {
...criticalPatchable,
Expand Down

0 comments on commit 0a8ac3c

Please sign in to comment.