@@ -24,11 +24,15 @@ func TestNewPushCmd(t *testing.T) {
2424 Authorize : true ,
2525 FileType : "text" ,
2626 Directory : "." ,
27- Directives : [ ]string {"01" , "05" },
27+ Directives : map [ string ]string {"key1" : " 01" , "key5" : "05" },
2828 }
29- filesSrv .On ("RunPush" , params ).Run (func (args mock.Arguments ) {
30- fmt .Fprintln (buf , fmt .Sprintf ("RunPush was called with %d args" , len (args )))
31- fmt .Fprintln (buf , fmt .Sprintf ("params: %v" , args [0 ]))
29+ filesSrv .On ("RunPush" , mock .Anything , params ).Run (func (args mock.Arguments ) {
30+ if _ , err := fmt .Fprintf (buf , "RunPush was called with %d args\n " , len (args )); err != nil {
31+ t .Fatal (err )
32+ }
33+ if _ , err := fmt .Fprintf (buf , "params: %v\n " , args [1 ]); err != nil {
34+ t .Fatal (err )
35+ }
3236 }).Return (nil )
3337
3438 initializer := cmdmocks .NewMockSrvInitializer (t )
@@ -46,8 +50,8 @@ func TestNewPushCmd(t *testing.T) {
4650 "--locale" , params .Locales [1 ],
4751 "--branch" , params .Branch ,
4852 "--type" , params .FileType ,
49- "--directive" , params . Directives [ 0 ] ,
50- "--directive" , params . Directives [ 1 ] ,
53+ "--directive" , "key1=01" ,
54+ "--directive" , "key5=05" ,
5155 })
5256
5357 err := cmd .Execute ()
@@ -56,7 +60,7 @@ func TestNewPushCmd(t *testing.T) {
5660 }
5761
5862 output := buf .String ()
59- expected := fmt .Sprintf (`RunPush was called with 1 args
63+ expected := fmt .Sprintf (`RunPush was called with 2 args
6064params: %v
6165` , params )
6266
0 commit comments