@@ -13,6 +13,7 @@ import { Experiments } from '../../../experiments'
1313import * as QuickPick from '../../../vscode/quickPick'
1414import { DvcExecutor } from '../../../cli/dvc/executor'
1515import {
16+ bypassProgressCloseDelay ,
1617 closeAllEditors ,
1718 getInputBoxEvent ,
1819 getTimeSafeDisposer ,
@@ -657,6 +658,112 @@ suite('Workspace Experiments Test Suite', () => {
657658 } )
658659 } )
659660
661+ describe ( 'dvc.pushExperiments' , ( ) => {
662+ it ( 'should ask the user to pick experiment(s) and then push selected ones to the remote' , async ( ) => {
663+ bypassProgressCloseDelay ( )
664+ const mockExperimentId = 'exp-e7a67'
665+ const secondMockExperimentId = 'exp-83425'
666+ type QuickPickReturnValue = QuickPickItemWithValue < string > [ ]
667+ stub ( Setup . prototype , 'getStudioAccessToken' ) . returns ( 'isat_token' )
668+
669+ const { experiments } = buildExperiments ( disposable )
670+
671+ await experiments . isReady ( )
672+
673+ stubWorkspaceExperimentsGetters ( dvcDemoPath , experiments )
674+
675+ const mockShowQuickPick = stub ( window , 'showQuickPick' ) as SinonStub <
676+ [ items : readonly QuickPickItem [ ] , options : QuickPickOptionsWithTitle ] ,
677+ Thenable < QuickPickReturnValue | undefined >
678+ >
679+
680+ mockShowQuickPick
681+ . onFirstCall ( )
682+ . resolves ( [
683+ {
684+ value : mockExperimentId
685+ }
686+ ] as QuickPickReturnValue )
687+ . onSecondCall ( )
688+ . resolves ( [
689+ {
690+ value : mockExperimentId
691+ } ,
692+ {
693+ value : secondMockExperimentId
694+ }
695+ ] as QuickPickReturnValue )
696+ const mockExpPush = stub ( DvcExecutor . prototype , 'expPush' )
697+
698+ await commands . executeCommand ( RegisteredCliCommands . EXPERIMENT_PUSH )
699+ expect ( mockShowQuickPick ) . calledWithExactly (
700+ [
701+ {
702+ description : '[exp-e7a67]' ,
703+ detail : `Created:${ formatDate (
704+ '2020-12-29T15:31:52'
705+ ) } , loss:2.0205045, accuracy:0.37241668`,
706+ label : '4fb124a' ,
707+ value : 'exp-e7a67'
708+ } ,
709+ {
710+ description : '[test-branch]' ,
711+ detail : `Created:${ formatDate (
712+ '2020-12-29T15:28:59'
713+ ) } , loss:1.9293040, accuracy:0.46680000`,
714+ label : '42b8736' ,
715+ value : 'test-branch'
716+ } ,
717+ {
718+ description : '[exp-83425]' ,
719+ detail : `Created:${ formatDate (
720+ '2020-12-29T15:27:02'
721+ ) } , loss:1.7750162, accuracy:0.59265000`,
722+ label : EXPERIMENT_WORKSPACE_ID ,
723+ value : 'exp-83425'
724+ } ,
725+ {
726+ description : undefined ,
727+ detail : 'Created:-, loss:-, accuracy:-' ,
728+ label : '489fd8b' ,
729+ value : '489fd8b'
730+ } ,
731+ {
732+ description : '[exp-f13bca]' ,
733+ detail : `Created:${ formatDate (
734+ '2020-12-29T15:26:36'
735+ ) } , loss:-, accuracy:-`,
736+ label : 'f0f9186' ,
737+ value : 'exp-f13bca'
738+ } ,
739+ {
740+ description : undefined ,
741+ detail : `Created:${ formatDate (
742+ '2020-12-29T15:25:27'
743+ ) } , loss:-, accuracy:-`,
744+ label : '55d492c' ,
745+ value : '55d492c'
746+ }
747+ ] ,
748+ {
749+ canPickMany : true ,
750+ matchOnDescription : true ,
751+ matchOnDetail : true ,
752+ title : 'Select Experiment(s) to Push'
753+ }
754+ )
755+ expect ( mockExpPush ) . to . be . calledWith ( dvcDemoPath , mockExperimentId )
756+
757+ await commands . executeCommand ( RegisteredCliCommands . EXPERIMENT_PUSH )
758+
759+ expect ( mockExpPush ) . to . be . calledWith (
760+ dvcDemoPath ,
761+ mockExperimentId ,
762+ secondMockExperimentId
763+ )
764+ } )
765+ } )
766+
660767 describe ( 'dvc.removeExperiments' , ( ) => {
661768 it ( 'should ask the user to pick experiment(s) and then remove selected ones from the workspace' , async ( ) => {
662769 const mockExperimentId = 'exp-e7a67'
@@ -754,7 +861,7 @@ suite('Workspace Experiments Test Suite', () => {
754861 canPickMany : true ,
755862 matchOnDescription : true ,
756863 matchOnDetail : true ,
757- title : 'Select Experiments to Remove'
864+ title : 'Select Experiment(s) to Remove'
758865 }
759866 )
760867 expect ( mockExperimentRemove ) . to . be . calledWith (
0 commit comments