Skip to content

Commit 6dc684f

Browse files
Fix unit test expectated results 🤦
1 parent c9038f5 commit 6dc684f

1 file changed

Lines changed: 25 additions & 11 deletions

File tree

extensions/ql-vscode/test/pure-tests/variant-analysis.test.ts

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { expect } from 'chai';
2-
import { VariantAnalysis, parseVariantAnalysisQueryLanguage, VariantAnalysisQueryLanguage, VariantAnalysisStatus, isVariantAnalysisComplete } from '../../src/remote-queries/shared/variant-analysis';
2+
import { VariantAnalysis, parseVariantAnalysisQueryLanguage, VariantAnalysisQueryLanguage, VariantAnalysisStatus, isVariantAnalysisComplete, VariantAnalysisRepoStatus } from '../../src/remote-queries/shared/variant-analysis';
3+
import { createMockScannedRepo } from '../../src/vscode-tests/factories/remote-queries/shared/scanned-repositories';
34
import { createMockVariantAnalysis } from '../../src/vscode-tests/factories/remote-queries/shared/variant-analysis';
45

56
describe('parseVariantAnalysisQueryLanguage', () => {
@@ -41,7 +42,7 @@ describe('isVariantAnalysisComplete', async () => {
4142

4243
describe('when all results are downloaded', async () => {
4344
it('should say the variant analysis is complete', async () => {
44-
expect(await isVariantAnalysisComplete(variantAnalysis, async () => true)).to.equal(true);
45+
expect(await isVariantAnalysisComplete(variantAnalysis, async () => true)).to.equal(false);
4546
});
4647
});
4748
});
@@ -71,17 +72,30 @@ describe('isVariantAnalysisComplete', async () => {
7172
});
7273
});
7374

74-
describe('when scanned repos is non-empty', async () => {
75-
describe('when not all results are downloaded', async () => {
76-
it('should say the variant analysis is not complete', async () => {
77-
expect(await isVariantAnalysisComplete(variantAnalysis, async () => false)).to.equal(false);
78-
});
75+
describe('when a repo scan is still in progress', async () => {
76+
it('should say the variant analysis is not complete', async () => {
77+
variantAnalysis.scannedRepos = [
78+
createMockScannedRepo('in-progress-repo', false, VariantAnalysisRepoStatus.InProgress),
79+
];
80+
expect(await isVariantAnalysisComplete(variantAnalysis, async () => false)).to.equal(false);
7981
});
82+
});
8083

81-
describe('when all results are downloaded', async () => {
82-
it('should say the variant analysis is complete', async () => {
83-
expect(await isVariantAnalysisComplete(variantAnalysis, async () => true)).to.equal(true);
84-
});
84+
describe('when not all results are downloaded', async () => {
85+
it('should say the variant analysis is not complete', async () => {
86+
variantAnalysis.scannedRepos = [
87+
createMockScannedRepo('in-progress-repo', false, VariantAnalysisRepoStatus.Succeeded),
88+
];
89+
expect(await isVariantAnalysisComplete(variantAnalysis, async () => false)).to.equal(false);
90+
});
91+
});
92+
93+
describe('when all results are downloaded', async () => {
94+
it('should say the variant analysis is complete', async () => {
95+
variantAnalysis.scannedRepos = [
96+
createMockScannedRepo('in-progress-repo', false, VariantAnalysisRepoStatus.Succeeded),
97+
];
98+
expect(await isVariantAnalysisComplete(variantAnalysis, async () => true)).to.equal(true);
8599
});
86100
});
87101
});

0 commit comments

Comments
 (0)