@@ -216,13 +216,15 @@ describe("createUpsertLetterHandler", () => {
216216 supplierSpec : {
217217 supplierId : "supplier1" ,
218218 specId : "spec1" ,
219+ billingId : "billing1" ,
219220 } ,
220221 } ;
221222 const v1message = {
222223 letterEvent : createPreparedV1Event ( ) ,
223224 supplierSpec : {
224- supplierId : "supplier1" ,
225- specId : "spec1" ,
225+ supplierId : "supplier2" ,
226+ specId : "spec2" ,
227+ billingId : "billing2" ,
226228 } ,
227229 } ;
228230
@@ -257,19 +259,19 @@ describe("createUpsertLetterHandler", () => {
257259 expect ( insertedV2Letter . status ) . toBe ( "PENDING" ) ;
258260 expect ( insertedV2Letter . groupId ) . toBe ( "client1campaign1template1" ) ;
259261 expect ( insertedV2Letter . source ) . toBe ( "/data-plane/letter-rendering/test" ) ;
260- expect ( insertedV2Letter . specificationBillingId ) . toBe ( "spec1 " ) ;
262+ expect ( insertedV2Letter . specificationBillingId ) . toBe ( "billing1 " ) ;
261263
262264 const insertedV1Letter = ( mockedDeps . letterRepo . putLetter as jest . Mock ) . mock
263265 . calls [ 1 ] [ 0 ] ;
264266 expect ( insertedV1Letter . id ) . toBe ( "letter1" ) ;
265- expect ( insertedV1Letter . supplierId ) . toBe ( "supplier1 " ) ;
266- expect ( insertedV1Letter . specificationId ) . toBe ( "spec1 " ) ;
267- expect ( insertedV1Letter . billingRef ) . toBe ( "spec1 " ) ;
267+ expect ( insertedV1Letter . supplierId ) . toBe ( "supplier2 " ) ;
268+ expect ( insertedV1Letter . specificationId ) . toBe ( "spec2 " ) ;
269+ expect ( insertedV1Letter . billingRef ) . toBe ( "spec2 " ) ;
268270 expect ( insertedV1Letter . url ) . toBe ( "s3://letterDataBucket/letter1.pdf" ) ;
269271 expect ( insertedV1Letter . status ) . toBe ( "PENDING" ) ;
270272 expect ( insertedV1Letter . groupId ) . toBe ( "client1campaign1template1" ) ;
271273 expect ( insertedV1Letter . source ) . toBe ( "/data-plane/letter-rendering/test" ) ;
272- expect ( insertedV1Letter . specificationBillingId ) . toBe ( "spec1 " ) ;
274+ expect ( insertedV1Letter . specificationBillingId ) . toBe ( "billing2 " ) ;
273275
274276 const updatedLetter = (
275277 mockedDeps . letterRepo . updateLetterStatus as jest . Mock
@@ -285,7 +287,12 @@ describe("createUpsertLetterHandler", () => {
285287 } ) ;
286288 expect ( mockMetrics . putMetric ) . toHaveBeenCalledWith (
287289 "MessagesProcessed" ,
288- 3 ,
290+ 2 ,
291+ "Count" ,
292+ ) ;
293+ expect ( mockMetrics . putMetric ) . toHaveBeenCalledWith (
294+ "MessagesProcessed" ,
295+ 1 ,
289296 "Count" ,
290297 ) ;
291298 } ) ;
@@ -485,6 +492,7 @@ describe("createUpsertLetterHandler", () => {
485492 supplierSpec : {
486493 supplierId : "supplier1" ,
487494 specId : "spec1" ,
495+ billingId : "billing1" ,
488496 } ,
489497 } ;
490498 const message2 = {
@@ -495,6 +503,7 @@ describe("createUpsertLetterHandler", () => {
495503 supplierSpec : {
496504 supplierId : "supplier1" ,
497505 specId : "spec1" ,
506+ billingId : "billing1" ,
498507 } ,
499508 } ;
500509 const evt : SQSEvent = createSQSEvent ( [
0 commit comments