@@ -201,7 +201,7 @@ describe('Testing jsonapi-server', () => {
201201
202202 assert . equal ( res . statusCode , '200' , 'Expecting 200 OK' )
203203 const photoTypes = json . data . map ( i => i . attributes . raw )
204- assert . deepEqual ( photoTypes , [ true ] , 'expected matching resources' )
204+ assert . deepEqual ( photoTypes , [ true , true ] , 'expected matching resources' )
205205
206206 done ( )
207207 } )
@@ -530,13 +530,13 @@ describe('Testing jsonapi-server', () => {
530530 json = helpers . validateJson ( json )
531531
532532 assert . equal ( res . statusCode , '200' , 'Expecting 200 OK' )
533- assert . equal ( json . included . length , 7 , 'Should be 7 included resources' )
533+ assert . equal ( json . included . length , 8 , 'Should be 8 included resources' )
534534
535535 const people = json . included . filter ( resource => resource . type === 'people' )
536536 assert . equal ( people . length , 4 , 'Should be 4 included people resources' )
537537
538538 const photos = json . included . filter ( resource => resource . type === 'photos' )
539- assert . equal ( photos . length , 3 , 'Should be 3 included photos resources' )
539+ assert . equal ( photos . length , 4 , 'Should be 4 included photos resources' )
540540
541541 done ( )
542542 } )
@@ -552,13 +552,13 @@ describe('Testing jsonapi-server', () => {
552552 json = helpers . validateJson ( json )
553553
554554 assert . equal ( res . statusCode , '200' , 'Expecting 200 OK' )
555- assert . equal ( json . included . length , 7 , 'Should be 7 included resources' )
555+ assert . equal ( json . included . length , 8 , 'Should be 8 included resources' )
556556
557557 const people = json . included . filter ( resource => resource . type === 'people' )
558558 assert . equal ( people . length , 4 , 'Should be 4 included people resources' )
559559
560560 const photos = json . included . filter ( resource => resource . type === 'photos' )
561- assert . equal ( photos . length , 3 , 'Should be 3 included photos resources' )
561+ assert . equal ( photos . length , 4 , 'Should be 4 included photos resources' )
562562
563563 done ( )
564564 } )
@@ -585,6 +585,50 @@ describe('Testing jsonapi-server', () => {
585585 done ( )
586586 } )
587587 } )
588+
589+ it ( 'include author.photos with multiple filters' , done => {
590+ const url = 'http://localhost:16006/rest/articles?include=author.photos&filter[author]=ad3aa89e-9c5b-4ac9-a652-6670f9f27587&filter[author]=cc5cca2e-0dd8-4b95-8cfc-a11230e73116'
591+ helpers . request ( {
592+ method : 'GET' ,
593+ url
594+ } , ( err , res , json ) => {
595+ assert . equal ( err , null )
596+ json = helpers . validateJson ( json )
597+
598+ assert . equal ( res . statusCode , '200' , 'Expecting 200 OK' )
599+ assert . equal ( json . included . length , 5 , 'Should be 2 included resources' )
600+
601+ const people = json . included . filter ( resource => resource . type === 'people' )
602+ assert . equal ( people . length , 2 , 'Should be 2 included people resource' )
603+
604+ const photos = json . included . filter ( resource => resource . type === 'photos' )
605+ assert . equal ( photos . length , 3 , 'Should be 2 included photos resource' )
606+
607+ done ( )
608+ } )
609+ } )
610+
611+ it ( 'include author.photos with multiple filters comma delineated' , done => {
612+ const url = 'http://localhost:16006/rest/articles?include=author.photos&filter[author][firstname]=Mark,Oli'
613+ helpers . request ( {
614+ method : 'GET' ,
615+ url
616+ } , ( err , res , json ) => {
617+ assert . equal ( err , null )
618+ json = helpers . validateJson ( json )
619+
620+ assert . equal ( res . statusCode , '200' , 'Expecting 200 OK' )
621+ assert . equal ( json . included . length , 4 , 'Should be 2 included resources' )
622+
623+ const people = json . included . filter ( resource => resource . type === 'people' )
624+ assert . equal ( people . length , 2 , 'Should be 2 included people resource' )
625+
626+ const photos = json . included . filter ( resource => resource . type === 'photos' )
627+ assert . equal ( photos . length , 2 , 'Should be 2 included photos resource' )
628+
629+ done ( )
630+ } )
631+ } )
588632 } )
589633
590634 describe ( 'by foreign key' , ( ) => {
0 commit comments