@@ -273,21 +273,38 @@ describe('Resource', () => {
273273 } ) ;
274274
275275 describe ( 'update' , ( ) => {
276+ const id = '1' ;
277+ const attributes = { key : 'value' } ;
278+ const relationships = { key : 'value' } ;
279+
276280 it ( 'can update a record' , ( ) => {
277- const id = '1' ;
278- const attributes = { key : 'value' } ;
279- const relationships = { key : 'value' } ;
280281 const responseBody = { data : record } ;
281282 api . patch . mockResolvedValue ( { data : responseBody } ) ;
282283
283284 const result = resource . update ( { id, attributes, relationships } ) ;
284285
285- expect ( api . patch ) . toHaveBeenCalledWith ( 'widgets/1' , {
286+ expect ( api . patch ) . toHaveBeenCalledWith ( 'widgets/1? ' , {
286287 data : { id, type : 'widgets' , attributes, relationships } ,
287288 } ) ;
288289 return expect ( result ) . resolves . toEqual ( responseBody ) ;
289290 } ) ;
290291
292+ it ( 'passes options' , ( ) => {
293+ const responseBody = { data : record } ;
294+ api . patch . mockResolvedValue ( { data : responseBody } ) ;
295+
296+ const result = resource . update ( {
297+ id,
298+ attributes,
299+ relationships,
300+ options : optionsWithInclude ,
301+ } ) ;
302+
303+ expect ( api . patch ) . toHaveBeenCalledWith ( 'widgets/1?include=comments' , {
304+ data : { id, type : 'widgets' , attributes, relationships } ,
305+ } ) ;
306+ } ) ;
307+
291308 it ( 'rejects with the response upon error' , ( ) => {
292309 const errorResponse = { dummy : 'data' } ;
293310 api . patch . mockRejectedValue ( { response : errorResponse } ) ;
0 commit comments