@@ -495,6 +495,96 @@ describe('query-history', () => {
495495 } ) ;
496496 } ) ;
497497
498+ describe ( 'handleCopyRepoList' , ( ) => {
499+ it ( 'should not call a command for a local query' , async ( ) => {
500+ queryHistoryManager = await createMockQueryHistory ( localQueryHistory ) ;
501+
502+ const item = localQueryHistory [ 4 ] ;
503+ await queryHistoryManager . handleCopyRepoList ( item , [ item ] ) ;
504+
505+ expect ( executeCommandSpy ) . to . not . have . been . called ;
506+ } ) ;
507+
508+ it ( 'should copy repo list for a single remote query' , async ( ) => {
509+ queryHistoryManager = await createMockQueryHistory ( allHistory ) ;
510+
511+ const item = remoteQueryHistory [ 1 ] ;
512+ await queryHistoryManager . handleCopyRepoList ( item , [ item ] ) ;
513+ expect ( executeCommandSpy ) . to . have . been . calledWith ( 'codeQL.copyRepoList' , item . queryId ) ;
514+ } ) ;
515+
516+ it ( 'should not copy repo list for multiple remote queries' , async ( ) => {
517+ queryHistoryManager = await createMockQueryHistory ( allHistory ) ;
518+
519+ const item1 = remoteQueryHistory [ 1 ] ;
520+ const item2 = remoteQueryHistory [ 3 ] ;
521+ await queryHistoryManager . handleCopyRepoList ( item1 , [ item1 , item2 ] ) ;
522+ expect ( executeCommandSpy ) . not . to . have . been . called ;
523+ } ) ;
524+
525+ it ( 'should copy repo list for a single variant analysis' , async ( ) => {
526+ queryHistoryManager = await createMockQueryHistory ( allHistory ) ;
527+
528+ const item = variantAnalysisHistory [ 1 ] ;
529+ await queryHistoryManager . handleCopyRepoList ( item , [ item ] ) ;
530+ expect ( executeCommandSpy ) . to . have . been . calledWith ( 'codeQL.copyVariantAnalysisRepoList' , item . variantAnalysis . id ) ;
531+ } ) ;
532+
533+ it ( 'should not copy repo list for multiple variant analyses' , async ( ) => {
534+ queryHistoryManager = await createMockQueryHistory ( allHistory ) ;
535+
536+ const item1 = variantAnalysisHistory [ 1 ] ;
537+ const item2 = variantAnalysisHistory [ 3 ] ;
538+ await queryHistoryManager . handleCopyRepoList ( item1 , [ item1 , item2 ] ) ;
539+ expect ( executeCommandSpy ) . not . to . have . been . called ;
540+ } ) ;
541+ } ) ;
542+
543+ describe ( 'handleExportResults' , ( ) => {
544+ it ( 'should not call a command for a local query' , async ( ) => {
545+ queryHistoryManager = await createMockQueryHistory ( localQueryHistory ) ;
546+
547+ const item = localQueryHistory [ 4 ] ;
548+ await queryHistoryManager . handleExportResults ( item , [ item ] ) ;
549+
550+ expect ( executeCommandSpy ) . to . not . have . been . called ;
551+ } ) ;
552+
553+ it ( 'should export results for a single remote query' , async ( ) => {
554+ queryHistoryManager = await createMockQueryHistory ( allHistory ) ;
555+
556+ const item = remoteQueryHistory [ 1 ] ;
557+ await queryHistoryManager . handleExportResults ( item , [ item ] ) ;
558+ expect ( executeCommandSpy ) . to . have . been . calledWith ( 'codeQL.exportRemoteQueryResults' , item . queryId ) ;
559+ } ) ;
560+
561+ it ( 'should not export results for multiple remote queries' , async ( ) => {
562+ queryHistoryManager = await createMockQueryHistory ( allHistory ) ;
563+
564+ const item1 = remoteQueryHistory [ 1 ] ;
565+ const item2 = remoteQueryHistory [ 3 ] ;
566+ await queryHistoryManager . handleExportResults ( item1 , [ item1 , item2 ] ) ;
567+ expect ( executeCommandSpy ) . not . to . have . been . called ;
568+ } ) ;
569+
570+ it ( 'should export results for a single variant analysis' , async ( ) => {
571+ queryHistoryManager = await createMockQueryHistory ( allHistory ) ;
572+
573+ const item = variantAnalysisHistory [ 1 ] ;
574+ await queryHistoryManager . handleExportResults ( item , [ item ] ) ;
575+ expect ( executeCommandSpy ) . to . have . been . calledWith ( 'codeQL.exportVariantAnalysisResults' , item . variantAnalysis . id ) ;
576+ } ) ;
577+
578+ it ( 'should not export results for multiple variant analyses' , async ( ) => {
579+ queryHistoryManager = await createMockQueryHistory ( allHistory ) ;
580+
581+ const item1 = variantAnalysisHistory [ 1 ] ;
582+ const item2 = variantAnalysisHistory [ 3 ] ;
583+ await queryHistoryManager . handleExportResults ( item1 , [ item1 , item2 ] ) ;
584+ expect ( executeCommandSpy ) . not . to . have . been . called ;
585+ } ) ;
586+ } ) ;
587+
498588 describe ( 'determineSelection' , ( ) => {
499589 const singleItem = 'a' ;
500590 const multipleItems = [ 'b' , 'c' , 'd' ] ;
0 commit comments