@@ -327,78 +327,6 @@ describe('loopback json api belongsTo relationships', function () {
327327 } ) ;
328328 } ) ;
329329
330- describe . skip ( 'link related models as part of a create operation' , function ( ) {
331- it ( 'should create and link models' , function ( done ) {
332- request ( app ) . post ( '/posts' )
333- . send ( {
334- data : { type : 'posts' , attributes : { title : 'my post' , content : 'my post content' } } ,
335- relationships : { comments : { data : [
336- { type : 'comments' , id : 1 }
337- ] } }
338- } )
339- . set ( 'Accept' , 'application/vnd.api+json' )
340- . set ( 'Content-Type' , 'application/json' )
341- . end ( function ( err , res ) {
342- expect ( err ) . to . equal ( null ) ;
343- Comment . findById ( 1 , function ( err , comment ) {
344- expect ( err ) . to . equal ( null ) ;
345- expect ( comment ) . not . to . equal ( null ) ;
346- expect ( comment . postId ) . to . equal ( 2 ) ;
347- done ( ) ;
348- } ) ;
349- } ) ;
350- } ) ;
351- } ) ;
352-
353- describe . skip ( 'delete linkages to models as part of an update operation' , function ( ) {
354- it ( 'should update model linkages' , function ( done ) {
355- request ( app ) . patch ( '/posts/1' )
356- . send ( {
357- data : { type : 'posts' , attributes : { title : 'my post' , content : 'my post content' } } ,
358- relationships : { comments : { data : [ ] } }
359- } )
360- . set ( 'Accept' , 'application/vnd.api+json' )
361- . set ( 'Content-Type' , 'application/json' )
362- . end ( function ( err , res ) {
363- expect ( err ) . to . equal ( null ) ;
364- Comment . findById ( 1 , function ( err , comment ) {
365- expect ( err ) . to . equal ( null ) ;
366- expect ( comment ) . not . to . equal ( null ) ;
367- expect ( comment . postId ) . to . equal ( null ) ;
368- done ( ) ;
369- } ) ;
370- } ) ;
371- } ) ;
372- } ) ;
373-
374- describe . skip ( 'replace linkages as part of an update operation' , function ( ) {
375- beforeEach ( function ( done ) {
376- Comment . create ( {
377- title : 'my comment 2' ,
378- comment : 'my post comment 2'
379- } , done ) ;
380- } ) ;
381- it ( 'should update model linkages' , function ( done ) {
382- request ( app ) . patch ( '/posts/1' ) . send ( {
383- data : { type : 'posts' , attributes : { title : 'my post' , content : 'my post content' } } ,
384- relationships : { comments : { data : [
385- { type : 'comments' , id : 1 } ,
386- { type : 'comments' , id : 2 }
387- ] } }
388- } )
389- . set ( 'Accept' , 'application/vnd.api+json' )
390- . set ( 'Content-Type' , 'application/json' )
391- . end ( function ( err , res ) {
392- expect ( err ) . to . equal ( null ) ;
393- Comment . find ( { postId : 1 } , function ( err , comments ) {
394- expect ( err ) . to . equal ( null ) ;
395- expect ( comments . length ) . to . equal ( 2 ) ;
396- done ( ) ;
397- } ) ;
398- } ) ;
399- } ) ;
400- } ) ;
401-
402330 describe . skip ( 'link related models using relationship url' , function ( ) {
403331 beforeEach ( function ( done ) {
404332 Post . create ( { name : 'my post' , content : 'my post content' } , done ) ;
@@ -425,53 +353,5 @@ describe('loopback json api belongsTo relationships', function () {
425353 } ) ;
426354 } ) ;
427355
428- describe . skip ( 'delete linkages to models as part of an update operation' , function ( ) {
429- it ( 'should update model linkages' , function ( done ) {
430- request ( app ) . patch ( '/posts/1' )
431- . send ( {
432- data : { type : 'posts' , attributes : { title : 'my post' , content : 'my post content' } } ,
433- relationships : { comments : { data : [ ] } }
434- } )
435- . set ( 'Accept' , 'application/vnd.api+json' )
436- . set ( 'Content-Type' , 'application/json' )
437- . end ( function ( err , res ) {
438- expect ( err ) . to . equal ( null ) ;
439- Comment . findById ( 1 , function ( err , comment ) {
440- expect ( err ) . to . equal ( null ) ;
441- expect ( comment ) . not . to . equal ( null ) ;
442- expect ( comment . postId ) . to . equal ( null ) ;
443- done ( ) ;
444- } ) ;
445- } ) ;
446- } ) ;
447- } ) ;
448-
449- describe . skip ( 'replace linkages as part of an update operation' , function ( ) {
450- beforeEach ( function ( done ) {
451- Post . create ( {
452- name : 'my post' ,
453- content : 'my post content'
454- } , done ) ;
455- } ) ;
456- it ( 'should update model linkages' , function ( done ) {
457- request ( app ) . patch ( '/posts/1' ) . send ( {
458- data : { type : 'posts' , attributes : { title : 'my post' , content : 'my post content' } } ,
459- relationships : { comments : { data : [
460- { type : 'comments' , id : 1 } ,
461- { type : 'comments' , id : 2 }
462- ] } }
463- } )
464- . set ( 'Accept' , 'application/vnd.api+json' )
465- . set ( 'Content-Type' , 'application/json' )
466- . end ( function ( err , res ) {
467- expect ( err ) . to . equal ( null ) ;
468- Comment . find ( { postId : 1 } , function ( err , comments ) {
469- expect ( err ) . to . equal ( null ) ;
470- expect ( comments . length ) . to . equal ( 2 ) ;
471- done ( ) ;
472- } ) ;
473- } ) ;
474- } ) ;
475- } ) ;
476356 } ) ;
477357} ) ;
0 commit comments