@@ -6,7 +6,11 @@ import {
66} from "tests/helpers/event-fixtures" ;
77import { logger } from "tests/helpers/pino-logger" ;
88import { sendSnsBatchEvent , sendSnsEvent } from "tests/helpers/send-sns-event" ;
9- import { supplierIdFromSupplierAllocatorLog } from "tests/helpers/aws-cloudwatch-helper" ;
9+ import {
10+ pollUpdateLetterQueueDuplicateLog ,
11+ pollUpsertLetterLogForError ,
12+ supplierIdFromSupplierAllocatorLog ,
13+ } from "tests/helpers/aws-cloudwatch-helper" ;
1014import getRestApiGatewayBaseUrl from "tests/helpers/aws-gateway-helper" ;
1115import { SUPPLIER_LETTERS } from "tests/constants/api-constants" ;
1216import { supplierDataSetup } from "tests/helpers/suppliers-setup-helper" ;
@@ -85,18 +89,23 @@ test.describe("Letter Queue Tests", () => {
8589 message : event ,
8690 } ) ) ,
8791 ) ;
88- expect ( response . Successful ) . toBeTruthy ( ) ;
92+ expect ( response . Successful ) . toHaveLength ( eventBatch . length ) ;
8993
9094 const supplierId = await supplierIdFromSupplierAllocatorLog ( letterId ) ;
9195
9296 logger . info (
93- `Verifying if only one entry is inserted in the letter queue table for the batch of events with same letterId ${ letterId } ` ,
97+ `Verifying duplicate queue inserts are ignored for the batch of events with same letterId ${ letterId } ` ,
9498 ) ;
9599 const [ letterExists , itemCount ] = await checkLetterQueueTable (
96100 supplierId ,
97101 letterId ,
98102 ) ;
99103 expect ( letterExists ) . toBe ( true ) ;
100104 expect ( itemCount ) . toBe ( 1 ) ;
105+
106+ await pollUpsertLetterLogForError (
107+ `Letter with id ${ letterId } already exists for supplier ${ supplierId } "` ,
108+ letterId ,
109+ ) ;
101110 } ) ;
102111} ) ;
0 commit comments