@@ -22,7 +22,8 @@ import { CodeQLCliServer } from '../../../cli';
2222import { storagePath } from '../global.helper' ;
2323import { VariantAnalysisResultsManager } from '../../../remote-queries/variant-analysis-results-manager' ;
2424import { createMockVariantAnalysis } from '../../factories/remote-queries/shared/variant-analysis' ;
25- import { VariantAnalysis , VariantAnalysisStatus } from '../../../remote-queries/shared/variant-analysis' ;
25+ import { VariantAnalysis } from '../../../remote-queries/shared/variant-analysis' ;
26+ import * as VariantAnalysisModule from '../../../remote-queries/shared/variant-analysis' ;
2627
2728describe ( 'Variant Analysis Manager' , async function ( ) {
2829 let sandbox : sinon . SinonSandbox ;
@@ -209,7 +210,7 @@ describe('Variant Analysis Manager', async function() {
209210
210211 describe ( 'when the variant analysis is not complete' , async ( ) => {
211212 beforeEach ( ( ) => {
212- sinon . stub ( variantAnalysisManager , 'isVariantAnalysisComplete' ) . resolves ( false ) ;
213+ sandbox . stub ( VariantAnalysisModule , 'isVariantAnalysisComplete' ) . resolves ( false ) ;
213214 } ) ;
214215
215216 it ( 'should not remove the variant analysis' , async ( ) => {
@@ -225,7 +226,7 @@ describe('Variant Analysis Manager', async function() {
225226
226227 describe ( 'when the variant analysis is complete' , async ( ) => {
227228 beforeEach ( ( ) => {
228- sinon . stub ( variantAnalysisManager , 'isVariantAnalysisComplete' ) . resolves ( true ) ;
229+ sandbox . stub ( VariantAnalysisModule , 'isVariantAnalysisComplete' ) . resolves ( true ) ;
229230 } ) ;
230231
231232 it ( 'should not remove the variant analysis' , async ( ) => {
@@ -240,83 +241,4 @@ describe('Variant Analysis Manager', async function() {
240241 } ) ;
241242 } ) ;
242243 } ) ;
243-
244- describe ( 'isVariantAnalysisComplete' , async ( ) => {
245- let variantAnalysis : VariantAnalysis ;
246-
247- beforeEach ( ( ) => {
248- variantAnalysis = createMockVariantAnalysis ( ) ;
249- } ) ;
250-
251- describe ( 'when variant analysis status is InProgress' , async ( ) => {
252- beforeEach ( ( ) => {
253- variantAnalysis . status = VariantAnalysisStatus . InProgress ;
254- } ) ;
255-
256- describe ( 'when scanned repos is undefined' , async ( ) => {
257- it ( 'should say the variant analysis is not complete' , async ( ) => {
258- variantAnalysis . scannedRepos = undefined ;
259- expect ( variantAnalysisManager . isVariantAnalysisComplete ( variantAnalysis ) ) . to . equal ( false ) ;
260- } ) ;
261- } ) ;
262-
263- describe ( 'when scanned repos is non-empty' , async ( ) => {
264- describe ( 'when not all results are downloaded' , async ( ) => {
265- it ( 'should say the variant analysis is not complete' , async ( ) => {
266- sinon . stub ( variantAnalysisResultsManager , 'isVariantAnalysisRepoDownloaded' ) . resolves ( false ) ;
267- expect ( variantAnalysisManager . isVariantAnalysisComplete ( variantAnalysis ) ) . to . equal ( false ) ;
268- } ) ;
269- } ) ;
270-
271- describe ( 'when all results are downloaded' , async ( ) => {
272- it ( 'should say the variant analysis is complete' , async ( ) => {
273- sinon . stub ( variantAnalysisResultsManager , 'isVariantAnalysisRepoDownloaded' ) . resolves ( true ) ;
274- expect ( variantAnalysisManager . isVariantAnalysisComplete ( variantAnalysis ) ) . to . equal ( true ) ;
275- } ) ;
276- } ) ;
277- } ) ;
278- } ) ;
279-
280- for ( const variantAnalysisStatus of [
281- VariantAnalysisStatus . Succeeded ,
282- VariantAnalysisStatus . Failed ,
283- VariantAnalysisStatus . Canceled
284- ] ) {
285- describe ( `when variant analysis status is ${ variantAnalysisStatus } ` , async ( ) => {
286- beforeEach ( ( ) => {
287- variantAnalysis . status = variantAnalysisStatus ;
288- } ) ;
289-
290- describe ( 'when scanned repos is undefined' , async ( ) => {
291- it ( 'should say the variant analysis is complete' , async ( ) => {
292- variantAnalysis . scannedRepos = undefined ;
293- expect ( variantAnalysisManager . isVariantAnalysisComplete ( variantAnalysis ) ) . to . equal ( true ) ;
294- } ) ;
295- } ) ;
296-
297- describe ( 'when scanned repos is empty' , async ( ) => {
298- it ( 'should say the variant analysis is complete' , async ( ) => {
299- variantAnalysis . scannedRepos = [ ] ;
300- expect ( variantAnalysisManager . isVariantAnalysisComplete ( variantAnalysis ) ) . to . equal ( true ) ;
301- } ) ;
302- } ) ;
303-
304- describe ( 'when scanned repos is non-empty' , async ( ) => {
305- describe ( 'when not all results are downloaded' , async ( ) => {
306- it ( 'should say the variant analysis is not complete' , async ( ) => {
307- sinon . stub ( variantAnalysisResultsManager , 'isVariantAnalysisRepoDownloaded' ) . resolves ( false ) ;
308- expect ( variantAnalysisManager . isVariantAnalysisComplete ( variantAnalysis ) ) . to . equal ( false ) ;
309- } ) ;
310- } ) ;
311-
312- describe ( 'when all results are downloaded' , async ( ) => {
313- it ( 'should say the variant analysis is complete' , async ( ) => {
314- sinon . stub ( variantAnalysisResultsManager , 'isVariantAnalysisRepoDownloaded' ) . resolves ( true ) ;
315- expect ( variantAnalysisManager . isVariantAnalysisComplete ( variantAnalysis ) ) . to . equal ( true ) ;
316- } ) ;
317- } ) ;
318- } ) ;
319- } ) ;
320- }
321- } ) ;
322244} ) ;
0 commit comments