@@ -294,7 +294,7 @@ describe('NotificationConfiguration.restrictSupportedNotificationBasedOnLifecycl
294294describe ( 'NotificationConfiguration.getConfigXML - XML escaping for special characters' , ( ) => {
295295 const specialCharacters = [ '&' , '<' , '>' , '"' , "'" ] ;
296296
297- specialCharacters . forEach ( char =>
297+ specialCharacters . forEach ( char => {
298298 it ( `should escape \`${ char } \` in notification ID and generate valid XML` , done => {
299299 const config = {
300300 queueConfig : [ {
@@ -313,10 +313,8 @@ describe('NotificationConfiguration.getConfigXML - XML escaping for special char
313313 assert . strictEqual ( queueConfig . Id [ 0 ] , `test-id${ char } value` ) ;
314314 done ( ) ;
315315 } ) ;
316- } )
317- ) ;
316+ } ) ;
318317
319- specialCharacters . forEach ( char =>
320318 it ( `should escape \`${ char } \` in queue ARN` , done => {
321319 const config = {
322320 queueConfig : [ {
@@ -335,10 +333,8 @@ describe('NotificationConfiguration.getConfigXML - XML escaping for special char
335333 assert . strictEqual ( queueConfig . Queue [ 0 ] , `arn:scality:bucketnotif:::queue${ char } name` ) ;
336334 done ( ) ;
337335 } ) ;
338- } )
339- ) ;
336+ } ) ;
340337
341- specialCharacters . forEach ( char =>
342338 it ( `should escape \`${ char } \` in filter rule name and value` , done => {
343339 const config = {
344340 queueConfig : [ {
@@ -362,63 +358,6 @@ describe('NotificationConfiguration.getConfigXML - XML escaping for special char
362358 assert . strictEqual ( filterRule . Value [ 0 ] , `logs/${ char } path` ) ;
363359 done ( ) ;
364360 } ) ;
365- } )
366- ) ;
367-
368- it ( 'should escape multiple special characters across all fields' , done => {
369- const config = {
370- queueConfig : [ {
371- id : 'id<test>&\'data\'' ,
372- queueArn : 'arn:scality:bucketnotif:::target&<queue>' ,
373- events : [ 's3:ObjectCreated:*' ] ,
374- filterRules : [ {
375- name : 'Prefix' ,
376- value : '<path>&"value"' ,
377- } ] ,
378- } ] ,
379- } ;
380-
381- const xml = NotificationConfiguration . getConfigXML ( config ) ;
382-
383- parseString ( xml , ( err , result ) => {
384- assert . ifError ( err ) ;
385- const queueConfig = result . NotificationConfiguration . QueueConfiguration [ 0 ] ;
386- assert . strictEqual ( queueConfig . Id [ 0 ] , 'id<test>&\'data\'' ) ;
387- assert . strictEqual ( queueConfig . Queue [ 0 ] , 'arn:scality:bucketnotif:::target&<queue>' ) ;
388- const filterRule = queueConfig . Filter [ 0 ] . S3Key [ 0 ] . FilterRule [ 0 ] ;
389- assert . strictEqual ( filterRule . Value [ 0 ] , '<path>&"value"' ) ;
390- done ( ) ;
391- } ) ;
392- } ) ;
393-
394- it ( 'should handle multiple filter rules with special characters' , done => {
395- const config = {
396- queueConfig : [ {
397- id : 'test-id' ,
398- queueArn : 'arn:scality:bucketnotif:::target' ,
399- events : [ 's3:ObjectCreated:*' ] ,
400- filterRules : [
401- {
402- name : 'Prefix' ,
403- value : 'logs/<app>&env' ,
404- } ,
405- {
406- name : 'Suffix' ,
407- value : '.log&.txt' ,
408- } ,
409- ] ,
410- } ] ,
411- } ;
412-
413- const xml = NotificationConfiguration . getConfigXML ( config ) ;
414-
415- parseString ( xml , ( err , result ) => {
416- assert . ifError ( err ) ;
417- const queueConfig = result . NotificationConfiguration . QueueConfiguration [ 0 ] ;
418- const filterRules = queueConfig . Filter [ 0 ] . S3Key [ 0 ] . FilterRule ;
419- assert . strictEqual ( filterRules [ 0 ] . Value [ 0 ] , 'logs/<app>&env' ) ;
420- assert . strictEqual ( filterRules [ 1 ] . Value [ 0 ] , '.log&.txt' ) ;
421- done ( ) ;
422361 } ) ;
423362 } ) ;
424363} ) ;
0 commit comments