@@ -94,6 +94,63 @@ describe('Auth0RestClient', function() {
9494 } ) ;
9595 } ) ;
9696
97+ describe ( '`patch`' , ( ) => {
98+ it ( 'should encode params.id on `patch` requests' , function ( done ) {
99+ nock ( API_URL )
100+ . patch ( '/some-resource/auth0%7C1234%2F5678' )
101+ . reply ( 200 ) ;
102+
103+ var client = new Auth0RestClient (
104+ API_URL + '/some-resource/:id' ,
105+ { headers : { } } ,
106+ this . providerMock
107+ ) ;
108+ client . patch ( { id : 'auth0|1234/5678' } , { data : 'udpate ' } , function ( err , data ) {
109+ expect ( err ) . to . be . null ;
110+ done ( ) ;
111+ nock . cleanAll ( ) ;
112+ } ) ;
113+ } ) ;
114+ } ) ;
115+
116+ describe ( '`update`' , ( ) => {
117+ it ( 'should encode params.id on `update` requests' , function ( done ) {
118+ nock ( API_URL )
119+ . put ( '/some-resource/auth0%7C1234%2F5678' )
120+ . reply ( 200 ) ;
121+
122+ var client = new Auth0RestClient (
123+ API_URL + '/some-resource/:id' ,
124+ { headers : { } } ,
125+ this . providerMock
126+ ) ;
127+ client . update ( { id : 'auth0|1234/5678' } , { data : 'udpate ' } , function ( err , data ) {
128+ expect ( err ) . to . be . null ;
129+ done ( ) ;
130+ nock . cleanAll ( ) ;
131+ } ) ;
132+ } ) ;
133+ } ) ;
134+
135+ describe ( '`delete`' , ( ) => {
136+ it ( 'should encode params.id on `delete` requests' , function ( done ) {
137+ nock ( API_URL )
138+ . delete ( '/some-resource/auth0%7C1234%2F5678' )
139+ . reply ( 200 ) ;
140+
141+ var client = new Auth0RestClient (
142+ API_URL + '/some-resource/:id' ,
143+ { headers : { } } ,
144+ this . providerMock
145+ ) ;
146+ client . delete ( { id : 'auth0|1234/5678' } , function ( err , data ) {
147+ expect ( err ) . to . be . null ;
148+ done ( ) ;
149+ nock . cleanAll ( ) ;
150+ } ) ;
151+ } ) ;
152+ } ) ;
153+
97154 it ( 'should return a promise if no callback is given' , function ( done ) {
98155 nock ( API_URL )
99156 . get ( '/some-resource' )
0 commit comments