@@ -17,7 +17,7 @@ describe('pickAndModifyParams', () => {
1717 mockedQuickPickManyValues . mockResolvedValueOnce ( undefined )
1818
1919 const paramsToQueue = await pickAndModifyParams ( [
20- { isString : false , path : 'params.yaml:learning_rate' , value : 2e-12 }
20+ { path : 'params.yaml:learning_rate' , value : 2e-12 }
2121 ] )
2222
2323 expect ( paramsToQueue ) . toBeUndefined ( )
@@ -26,13 +26,12 @@ describe('pickAndModifyParams', () => {
2626
2727 it ( 'should return early if the user exits from the input box' , async ( ) => {
2828 const unchanged = {
29- isString : false ,
3029 path : 'params.yaml:learning_rate' ,
3130 value : 2e-12
3231 }
3332 const initialUserResponse = [
34- { isString : false , path : 'params.yaml:dropout' , value : 0.15 } ,
35- { isString : false , path : 'params.yaml:process.threshold' , value : 0.86 }
33+ { path : 'params.yaml:dropout' , value : 0.15 } ,
34+ { path : 'params.yaml:process.threshold' , value : 0.86 }
3635 ]
3736 mockedQuickPickManyValues . mockResolvedValueOnce ( initialUserResponse )
3837 const firstInput = '0.16'
@@ -50,37 +49,38 @@ describe('pickAndModifyParams', () => {
5049
5150 it ( 'should convert any selected params into the required format' , async ( ) => {
5251 const unchanged = {
53- isString : false ,
5452 path : 'params.yaml:learning_rate' ,
5553 value : 2e-12
5654 }
5755
5856 const initialUserResponse = [
59- { isString : false , path : 'params.yaml:dropout' , value : 0.15 } ,
60- { isString : false , path : 'params.yaml:process.threshold' , value : 0.86 } ,
61- { isString : false , path : 'params.yaml:code_names' , value : [ 0 , 1 , 2 ] } ,
57+ { path : 'params.yaml:dropout' , value : 0.15 } ,
58+ { path : 'params.yaml:process.threshold' , value : 0.86 } ,
59+ { path : 'params.yaml:code_names' , value : [ 0 , 1 , 2 ] } ,
60+ { path : 'params.yaml:arch' , value : 'resnet18' } ,
6261 {
63- isString : true ,
6462 path : 'params.yaml:transforms' ,
6563 value : '[Pipeline: PILBase.create, Pipeline: partial -> PILBase.create]'
6664 }
6765 ]
6866 mockedQuickPickManyValues . mockResolvedValueOnce ( initialUserResponse )
69- const firstInput = '0.16'
70- const secondInput = '0.87'
71- const thirdInput = '[0,1,3]'
72- const fourthInput = '[Pipeline: PILBase.create]'
73- mockedGetInput . mockResolvedValueOnce ( firstInput )
74- mockedGetInput . mockResolvedValueOnce ( secondInput )
75- mockedGetInput . mockResolvedValueOnce ( thirdInput )
76- mockedGetInput . mockResolvedValueOnce ( fourthInput )
67+ const input1 = '0.16'
68+ const input2 = '0.87,0.88'
69+ const input3 = '[0,1,3]'
70+ const input4 = 'resnet18,shufflenet_v2_x2_0'
71+ const input5 = "'[Pipeline: PILBase.create]'" // user needs to quote
72+ mockedGetInput . mockResolvedValueOnce ( input1 )
73+ mockedGetInput . mockResolvedValueOnce ( input2 )
74+ mockedGetInput . mockResolvedValueOnce ( input3 )
75+ mockedGetInput . mockResolvedValueOnce ( input4 )
76+ mockedGetInput . mockResolvedValueOnce ( input5 )
7777
7878 const paramsToQueue = await pickAndModifyParams ( [
7979 unchanged ,
8080 ...initialUserResponse
8181 ] )
8282
83- expect ( mockedGetInput ) . toHaveBeenCalledTimes ( 4 )
83+ expect ( mockedGetInput ) . toHaveBeenCalledTimes ( 5 )
8484 expect ( mockedGetInput ) . toHaveBeenCalledWith (
8585 'Enter a Value for params.yaml:dropout' ,
8686 '0.15'
@@ -96,20 +96,27 @@ describe('pickAndModifyParams', () => {
9696 '[0,1,2]'
9797 )
9898
99+ expect ( mockedGetInput ) . toHaveBeenCalledWith (
100+ 'Enter a Value for params.yaml:arch' ,
101+ 'resnet18'
102+ )
103+
99104 expect ( mockedGetInput ) . toHaveBeenCalledWith (
100105 'Enter a Value for params.yaml:transforms' ,
101106 '[Pipeline: PILBase.create, Pipeline: partial -> PILBase.create]'
102107 )
103108
104109 expect ( paramsToQueue ) . toStrictEqual ( [
105110 '-S' ,
106- `params.yaml:dropout=${ firstInput } ` ,
111+ `params.yaml:dropout=${ input1 } ` ,
112+ '-S' ,
113+ `params.yaml:process.threshold=${ input2 } ` ,
107114 '-S' ,
108- `params.yaml:process.threshold =${ secondInput } ` ,
115+ `params.yaml:code_names =${ input3 } ` ,
109116 '-S' ,
110- `params.yaml:code_names =${ thirdInput } ` ,
117+ `params.yaml:arch =${ input4 } ` ,
111118 '-S' ,
112- `params.yaml:transforms=' ${ fourthInput } ' `
119+ `params.yaml:transforms=${ input5 } `
113120 ] )
114121 } )
115122} )
0 commit comments