@@ -134,7 +134,7 @@ test('If an API has not been mocked, it should return a 404', async t => {
134134 t . fail ( 'Should throw' )
135135 } catch ( err ) {
136136 t . true ( err instanceof errors . ResponseError )
137- t . deepEqual ( err . body , { error : 'Mock not found' } )
137+ t . is ( err . body . error , 'Mock not found' )
138138 t . is ( err . statusCode , 404 )
139139 }
140140} )
@@ -490,7 +490,7 @@ test('The handler for the route exists, but the request is not enough precise',
490490 t . fail ( 'Should throw' )
491491 } catch ( err ) {
492492 t . true ( err instanceof errors . ResponseError )
493- t . deepEqual ( err . body , { error : 'Mock not found' } )
493+ t . is ( err . body . error , 'Mock not found' )
494494 t . is ( err . statusCode , 404 )
495495 }
496496} )
@@ -815,7 +815,7 @@ test('Should clear individual mocks', async t => {
815815 t . fail ( 'Should throw' )
816816 } catch ( err ) {
817817 t . true ( err instanceof errors . ResponseError )
818- t . deepEqual ( err . body , { error : 'Mock not found' } )
818+ t . is ( err . body . error , 'Mock not found' )
819819 t . is ( err . statusCode , 404 )
820820 }
821821} )
@@ -865,7 +865,7 @@ test('Should clear all mocks', async t => {
865865 t . fail ( 'Should throw' )
866866 } catch ( err ) {
867867 t . true ( err instanceof errors . ResponseError )
868- t . deepEqual ( err . body , { error : 'Mock not found' } )
868+ t . is ( err . body . error , 'Mock not found' )
869869 t . is ( err . statusCode , 404 )
870870 }
871871 try {
@@ -876,7 +876,7 @@ test('Should clear all mocks', async t => {
876876 t . fail ( 'Should throw' )
877877 } catch ( err ) {
878878 t . true ( err instanceof errors . ResponseError )
879- t . deepEqual ( err . body , { error : 'Mock not found' } )
879+ t . is ( err . body . error , 'Mock not found' )
880880 t . is ( err . statusCode , 404 )
881881 }
882882} )
@@ -969,3 +969,27 @@ test('Validate types on get()', t => {
969969 t . is ( err . message , 'The method is not defined' )
970970 }
971971} )
972+
973+ test ( 'should show passed params when no mock is found' , async t => {
974+ const mock = new Mock ( )
975+ mock . add ( { method : 'DELETE' , path : '/bar' } , ( ) => { } )
976+ const client = new Client ( {
977+ node : 'http://localhost:9200' ,
978+ Connection : mock . getConnection ( )
979+ } )
980+
981+ try {
982+ await client . info ( )
983+ t . fail ( 'should throw' )
984+ } catch ( err ) {
985+ t . deepEqual ( err . body , {
986+ error : 'Mock not found' ,
987+ params : {
988+ body : null ,
989+ method : 'GET' ,
990+ path : '/' ,
991+ querystring : { }
992+ }
993+ } )
994+ }
995+ } )
0 commit comments