Skip to content

Commit

Permalink
test: fix tests after reachability update
Browse files Browse the repository at this point in the history
  • Loading branch information
Mila Votradovec committed May 3, 2021
1 parent 4111e32 commit 0290866
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
12 changes: 7 additions & 5 deletions tests/api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']),
);
});

Expand Down Expand Up @@ -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 {
Expand All @@ -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,
);
Expand Down
6 changes: 3 additions & 3 deletions tests/git.analysis.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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');
Expand Down

0 comments on commit 0290866

Please sign in to comment.