import { IDeliveryNetworkResponse , Responses } from '../../../../lib' ; import { Context , Movie , setup } from '../../setup' ; describe ( 'Live items all' , ( ) => { const context = new Context ( ) ; setup ( context ) ; const type = 'movie' ; let response ; const responses = [ ] ; const pages = 2 ; const limit = 2 ; beforeAll ( async ( ) => { response = ( await context . deliveryClient . items < Movie > ( ) . limitParameter ( limit ) . type ( type ) . toAllPromise ( { responseFetched : ( innerResponse , nextPage , continuationToken ) => { responses . push ( innerResponse ) ; } , pages : pages } ) ) . data ; } ) ; it ( `items should be defined` , ( ) => { expect ( response ) . toBeDefined ( ) ; } ) ; it ( `check correct number of items` , ( ) => { expect ( response . items . length ) . toEqual ( pages * limit ) ; } ) ; it ( `items should have multiple responses` , ( ) => { expect ( response . responses . length ) . toEqual ( pages ) ; expect ( response . responses . length ) . toEqual ( responses . length ) ; for ( const innerResponse of response . responses ) { expect ( innerResponse . data ) . toBeDefined ( ) ; } } ) ; } ) ;