@@ -134,7 +134,7 @@ test('If an API has not been mocked, it should return a 404', async t => {
134
134
t . fail ( 'Should throw' )
135
135
} catch ( err ) {
136
136
t . true ( err instanceof errors . ResponseError )
137
- t . deepEqual ( err . body , { error : 'Mock not found' } )
137
+ t . is ( err . body . error , 'Mock not found' )
138
138
t . is ( err . statusCode , 404 )
139
139
}
140
140
} )
@@ -490,7 +490,7 @@ test('The handler for the route exists, but the request is not enough precise',
490
490
t . fail ( 'Should throw' )
491
491
} catch ( err ) {
492
492
t . true ( err instanceof errors . ResponseError )
493
- t . deepEqual ( err . body , { error : 'Mock not found' } )
493
+ t . is ( err . body . error , 'Mock not found' )
494
494
t . is ( err . statusCode , 404 )
495
495
}
496
496
} )
@@ -815,7 +815,7 @@ test('Should clear individual mocks', async t => {
815
815
t . fail ( 'Should throw' )
816
816
} catch ( err ) {
817
817
t . true ( err instanceof errors . ResponseError )
818
- t . deepEqual ( err . body , { error : 'Mock not found' } )
818
+ t . is ( err . body . error , 'Mock not found' )
819
819
t . is ( err . statusCode , 404 )
820
820
}
821
821
} )
@@ -865,7 +865,7 @@ test('Should clear all mocks', async t => {
865
865
t . fail ( 'Should throw' )
866
866
} catch ( err ) {
867
867
t . true ( err instanceof errors . ResponseError )
868
- t . deepEqual ( err . body , { error : 'Mock not found' } )
868
+ t . is ( err . body . error , 'Mock not found' )
869
869
t . is ( err . statusCode , 404 )
870
870
}
871
871
try {
@@ -876,7 +876,7 @@ test('Should clear all mocks', async t => {
876
876
t . fail ( 'Should throw' )
877
877
} catch ( err ) {
878
878
t . true ( err instanceof errors . ResponseError )
879
- t . deepEqual ( err . body , { error : 'Mock not found' } )
879
+ t . is ( err . body . error , 'Mock not found' )
880
880
t . is ( err . statusCode , 404 )
881
881
}
882
882
} )
@@ -969,3 +969,27 @@ test('Validate types on get()', t => {
969
969
t . is ( err . message , 'The method is not defined' )
970
970
}
971
971
} )
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