Skip to content

Commit 1fc81d9

Browse files
committed
test(kitsu-core): add test for ensuring all relationships exist in output
1 parent b058e42 commit 1fc81d9

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

packages/kitsu-core/src/deserialise/index.spec.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff 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
})

0 commit comments

Comments
 (0)