From 029086659e876d6ec1ba0f597be7fdbb5d594a32 Mon Sep 17 00:00:00 2001 From: Mila Votradovec Date: Fri, 30 Apr 2021 17:16:17 +0200 Subject: [PATCH] test: fix tests after reachability update --- tests/api.spec.ts | 12 +++++++----- tests/git.analysis.spec.ts | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/api.spec.ts b/tests/api.spec.ts index 0d409b68..38250776 100644 --- a/tests/api.spec.ts +++ b/tests/api.spec.ts @@ -42,7 +42,7 @@ describe('Requests to public API', () => { if (response.type === 'error') return; expect(new Set(response.value.configFiles)).toEqual(new Set(['.dcignore', '.gitignore'])); expect(new Set(response.value.extensions)).toEqual( - new Set(['.es', '.es6', '.htm', '.html', '.js', '.jsx', '.py', '.ts', '.tsx', '.vue', '.java']), + new Set(['.es', '.es6', '.htm', '.html', '.js', '.jsx', '.py', '.ts', '.tsx', '.vue', '.java', '.java-dummy']), ); }); @@ -404,8 +404,9 @@ describe('Requests to public API', () => { } while (response.value.status !== AnalysisStatus.done); expect(Object.keys(response.value.analysisResults.suggestions).length).toEqual(4); - expect(new Set(Object.keys(response.value.analysisResults.files))) - .toEqual(new Set(['/GitHubAccessTokenScrambler12.java', '/not/ignored/this_should_not_be_ignored.java'])); + expect(new Set(Object.keys(response.value.analysisResults.files))).toEqual( + new Set(['/GitHubAccessTokenScrambler12.java', '/not/ignored/this_should_not_be_ignored.java']), + ); // Get analysis results without linters but with severity 3 do { @@ -423,8 +424,9 @@ describe('Requests to public API', () => { } while (response.value.status !== AnalysisStatus.done); expect(Object.keys(response.value.analysisResults.suggestions).length).toEqual(2); - expect(new Set(Object.keys(response.value.analysisResults.files))) - .toEqual(new Set(['/GitHubAccessTokenScrambler12.java', '/not/ignored/this_should_not_be_ignored.java'])); + expect(new Set(Object.keys(response.value.analysisResults.files))).toEqual( + new Set(['/GitHubAccessTokenScrambler12.java', '/not/ignored/this_should_not_be_ignored.java']), + ); }, TEST_TIMEOUT, ); diff --git a/tests/git.analysis.spec.ts b/tests/git.analysis.spec.ts index 8ea73002..220250f5 100644 --- a/tests/git.analysis.spec.ts +++ b/tests/git.analysis.spec.ts @@ -95,7 +95,7 @@ describe('Functional test of analysis', () => { }); // Test DC JSON format first - expect(Object.keys(bundle.analysisResults.suggestions).length).toEqual(119); + expect(Object.keys(bundle.analysisResults.suggestions).length).toEqual(134); const cweSuggestion = Object.values(bundle.analysisResults.suggestions).find( s => s.id === 'java%2Fdc_interfile_project%2FPT', @@ -105,8 +105,8 @@ describe('Functional test of analysis', () => { expect(cweSuggestion?.title).toBeTruthy(); expect(cweSuggestion?.text).toBeTruthy(); - expect(bundle.sarifResults?.runs[0].results?.length).toEqual(400); - expect(bundle.sarifResults?.runs[0].tool?.driver.rules?.length).toEqual(119); + expect(bundle.sarifResults?.runs[0].results?.length).toEqual(442); + expect(bundle.sarifResults?.runs[0].tool?.driver.rules?.length).toEqual(134); const cweRule = bundle.sarifResults?.runs[0].tool?.driver.rules?.find(r => r.id === 'java/PT'); expect(cweRule?.properties?.cwe).toContain('CWE-23');