|
1 | 1 | 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'; |
3 | 4 | import { createMockVariantAnalysis } from '../../src/vscode-tests/factories/remote-queries/shared/variant-analysis'; |
4 | 5 |
|
5 | 6 | describe('parseVariantAnalysisQueryLanguage', () => { |
@@ -41,7 +42,7 @@ describe('isVariantAnalysisComplete', async () => { |
41 | 42 |
|
42 | 43 | describe('when all results are downloaded', async () => { |
43 | 44 | 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); |
45 | 46 | }); |
46 | 47 | }); |
47 | 48 | }); |
@@ -71,17 +72,30 @@ describe('isVariantAnalysisComplete', async () => { |
71 | 72 | }); |
72 | 73 | }); |
73 | 74 |
|
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); |
79 | 81 | }); |
| 82 | + }); |
80 | 83 |
|
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); |
85 | 99 | }); |
86 | 100 | }); |
87 | 101 | }); |
|
0 commit comments