File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,6 +54,38 @@ describe('kitsu', () => {
5454 } )
5555
5656 it ( 'sends bulk data in request' , async done => {
57+ expect . assertions ( 1 )
58+ const api = new Kitsu ( { headers : { Authorization : true } } )
59+ mock . onPatch ( '/posts' ) . reply ( config => {
60+ expect ( JSON . parse ( config . data ) ) . toEqual ( {
61+ data : [
62+ {
63+ id : '1' ,
64+ type : 'posts' ,
65+ attributes : {
66+ content : 'Hello World'
67+ }
68+ } ,
69+ {
70+ id : '2' ,
71+ type : 'posts' ,
72+ attributes : {
73+ content : 'Hey World'
74+ }
75+ }
76+ ]
77+ } )
78+ return [ 200 ]
79+ } )
80+ api . patch ( 'post' , [
81+ { id : '1' , content : 'Hello World' } ,
82+ { id : '2' , content : 'Hey World' }
83+ ] ) . catch ( err => {
84+ done . fail ( err )
85+ } )
86+ done ( )
87+ } )
88+
5789 it ( 'throws an error if missing a JSON object body' , async ( ) => {
5890 expect . assertions ( 1 )
5991 const api = new Kitsu ( )
You can’t perform that action at this time.
0 commit comments