File tree Expand file tree Collapse file tree
packages/kitsu-core/src/deserialise Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -488,5 +488,64 @@ describe('kitsu-core', () => {
488488 expect . assertions ( 1 )
489489 expect ( deserialise ( [ ] ) ) . toEqual ( [ ] )
490490 } )
491+
492+ it ( 'keeps all relationships' , ( ) => {
493+ expect . assertions ( 1 )
494+ expect ( deserialise ( {
495+ data : {
496+ id : '1' ,
497+ type : 'users' ,
498+ relationships : {
499+ waifu : {
500+ links : {
501+ self : 'https://kitsu.example' ,
502+ related : 'https://kitsu.example'
503+ }
504+ } ,
505+ followers : {
506+ links : {
507+ self : 'https://kitsu.example' ,
508+ related : 'https://kitsu.example'
509+ } ,
510+ data : [
511+ {
512+ id : '1' ,
513+ type : 'follows'
514+ }
515+ ]
516+ }
517+ }
518+ } ,
519+ included : [
520+ {
521+ id : '1' ,
522+ type : 'follows'
523+ }
524+ ]
525+ } ) ) . toEqual ( {
526+ data : {
527+ id : '1' ,
528+ type : 'users' ,
529+ waifu : {
530+ links : {
531+ self : 'https://kitsu.example' ,
532+ related : 'https://kitsu.example'
533+ }
534+ } ,
535+ followers : {
536+ links : {
537+ self : 'https://kitsu.example' ,
538+ related : 'https://kitsu.example'
539+ } ,
540+ data : [
541+ {
542+ id : '1' ,
543+ type : 'follows'
544+ }
545+ ]
546+ }
547+ }
548+ } )
549+ } )
491550 } )
492551} )
You can’t perform that action at this time.
0 commit comments