@@ -199,6 +199,40 @@ describe('Tagging orchestration', () => {
199199 assert . strictEqual ( tags [ `${ PAYLOAD_TAG_RESPONSE_PREFIX } .request` ] , 'foo' )
200200 } )
201201
202+ it ( 'should not fail if the response config contains invalid config' , ( ) => {
203+ const config = {
204+ request : [ 'invalid,request' ] ,
205+ response : [ 'invalid,$.foo,$.response' ] ,
206+ expand : [ ]
207+ }
208+ const input = {
209+ request : 'foo' ,
210+ response : 'bar' ,
211+ }
212+ const tags = computeTags ( config , input , { maxDepth : 10 , prefix : PAYLOAD_TAG_RESPONSE_PREFIX } )
213+ assert . strictEqual ( tags [ `${ PAYLOAD_TAG_RESPONSE_PREFIX } .response` ] , 'redacted' )
214+ assert . strictEqual ( tags [ `${ PAYLOAD_TAG_RESPONSE_PREFIX } .request` ] , 'foo' )
215+ } )
216+
217+ it ( 'should apply expansion rules with dollar identical to an empty input' , ( ) => {
218+ const config = {
219+ request : [ '$' ] ,
220+ response : [ '$' ] ,
221+ expand : [ '$.request' , '$.response' , '$.invalid' ] ,
222+ }
223+ const input = {
224+ request : '{ "foo": "bar" }' ,
225+ response : '{ "baz": "quux" }' ,
226+ invalid : '{ invalid JSON }' ,
227+ untargeted : '{ "foo": "bar" }' ,
228+ }
229+ const tags = computeTags ( config , input , { maxDepth : 10 , prefix : 'foo' } )
230+ assert . strictEqual ( tags [ 'foo.request.foo' ] , 'bar' )
231+ assert . strictEqual ( tags [ 'foo.response.baz' ] , 'quux' )
232+ assert . strictEqual ( tags [ 'foo.invalid' ] , '{ invalid JSON }' )
233+ assert . strictEqual ( tags [ 'foo.untargeted' ] , '{ "foo": "bar" }' )
234+ } )
235+
202236 it ( 'should apply expansion rules' , ( ) => {
203237 const config = {
204238 request : [ ] ,
0 commit comments