import { of } from 'rxjs' ; import { CatInterceptor } from './cat.interceptor' ; const returnCat = { name : 'Test Cat 1' , breed : 'Test Breed 1' , age : 4 , id : 1 } ; const next = { handle : ( ) => of ( returnCat ) , } ; describe ( 'CatInterceptor' , ( ) => { let interceptor ; beforeEach ( ( ) => { interceptor = new CatInterceptor ( ) ; } ) ; it ( 'should be defined' , ( ) => { expect ( interceptor ) . toBeDefined ( ) ; } ) ; describe ( 'should return the data wrapped in data object' , ( ) => { it ( 'should successfully return' , ( done ) => { interceptor . intercept ( { } as any , next ) . subscribe ( { next : ( value ) => { expect ( value ) . toEqual ( { data : returnCat } ) ; } , error : ( error ) => { throw error ; } , complete : ( ) => { done ( ) ; } , } ) ; } ) ; } ) ; } ) ;