@@ -49,35 +49,36 @@ describe('Execute', function() {
4949 return this . api . execute ( 'foo' , 'bar' , 'baz' ) . then ( function ( data ) {
5050 const [ url , opts ] = fetchMock . lastCall ( 'execute' )
5151 should ( url ) . endWith ( 'foo/bar/baz' )
52- should ( opts . method ) . equal ( 'PUT ' )
52+ should ( opts . method ) . equal ( 'POST ' )
5353 } )
5454 } )
5555
5656 it ( 'should call request() with proper params (with args)' , function ( ) {
5757 return this . api . execute ( 'foo' , 'bar' , 'baz' , { foo : 'barbaz' } ) . then ( function ( data ) {
5858 const [ url , opts ] = fetchMock . lastCall ( 'execute' )
59- should ( url ) . containEql ( 'foo/bar/baz' )
60- should ( url ) . containEql ( 'foo=barbaz' )
61- should ( opts . body ) . be . null ( )
62- should ( opts . method ) . equal ( 'PUT' )
59+ should ( url ) . endWith ( 'foo/bar/baz' )
60+ should ( opts . body ) . containEql ( `updates=${ encodeURIComponent ( JSON . stringify ( { foo : 'barbaz' } ) ) } ` )
61+ should ( opts . method ) . equal ( 'POST' )
6362 } )
6463 } )
6564
6665 it ( 'should call request() with proper params (with args) when objID is omitted' , function ( ) {
6766 return this . api . execute ( 'foo' , null , 'baz' , { foo : 'barbaz' } ) . then ( function ( data ) {
6867 const [ url , opts ] = fetchMock . lastCall ( 'execute' )
69- should ( url ) . endWith ( 'foo?foo=barbaz&action=baz' )
70- should ( opts . body ) . be . null ( )
71- should ( opts . method ) . equal ( 'PUT' )
68+ should ( url ) . containEql ( 'method=PUT' )
69+ should ( url ) . containEql ( 'action=baz' )
70+ should ( opts . body ) . containEql ( `updates=${ encodeURIComponent ( JSON . stringify ( { foo : 'barbaz' } ) ) } ` )
71+ should ( opts . method ) . equal ( 'POST' )
7272 } )
7373 } )
7474
7575 it ( 'should call request() with proper params (without args) when objID is omitted' , function ( ) {
7676 return this . api . execute ( 'foo' , null , 'baz' ) . then ( function ( data ) {
7777 const [ url , opts ] = fetchMock . lastCall ( 'execute' )
78- should ( url ) . endWith ( 'foo?action=baz' )
79- should ( opts . body ) . be . null ( )
80- should ( opts . method ) . equal ( 'PUT' )
78+ should ( url ) . containEql ( 'action=baz' )
79+ should ( url ) . containEql ( 'method=PUT' )
80+ should ( opts . body ) . not . be . ok ( )
81+ should ( opts . method ) . equal ( 'POST' )
8182 } )
8283 } )
8384} )
0 commit comments