@@ -13,6 +13,7 @@ import { Deps } from "../deps";
1313import { EnvVars } from "../env" ;
1414import mapLetterToCloudEvent from "../mappers/letter-mapper" ;
1515import { LetterStatus } from "../../../api-handler/src/contracts/letters" ;
16+ import { LetterWithSupplierId } from "../types" ;
1617
1718// Make crypto return consistent values, since we"re calling it in both prod and test code and comparing the values
1819const realCrypto = jest . requireActual ( "crypto" ) ;
@@ -147,7 +148,7 @@ describe("letter-updates-transformer Lambda", () => {
147148 it ( "does not publish invalid letter data" , async ( ) => {
148149 const handler = createHandler ( mockedDeps ) ;
149150 const oldLetter = generateLetter ( "ACCEPTED" ) ;
150- const newLetter = { id : oldLetter . id } as LetterBase ;
151+ const newLetter = { id : oldLetter . id } as LetterWithSupplierId ;
151152
152153 const testData = generateKinesisEvent ( [
153154 generateModifyRecord ( oldLetter , newLetter ) ,
@@ -252,27 +253,28 @@ describe("letter-updates-transformer Lambda", () => {
252253} ) ;
253254
254255
255- function generateLetter ( status : LetterStatus , id ?: string ) : LetterBase {
256+ function generateLetter ( status : LetterStatus , id ?: string ) : LetterWithSupplierId {
256257 return {
257258 id : id || "1" ,
258259 status,
259260 specificationId : "spec1" ,
261+ supplierId : "supplier1" ,
260262 groupId : "group1" ,
261263 } ;
262264}
263265
264266function generateLetters (
265267 numLetters : number ,
266268 status : LetterStatus ,
267- ) : LetterBase [ ] {
269+ ) : LetterWithSupplierId [ ] {
268270 return [ ...new Array ( numLetters ) . keys ( ) ] . map ( ( i ) =>
269271 generateLetter ( status , String ( i + 1 ) ) ,
270272 ) ;
271273}
272274
273275function generateModifyRecord (
274- oldLetter : LetterBase ,
275- newLetter : LetterBase ,
276+ oldLetter : LetterWithSupplierId ,
277+ newLetter : LetterWithSupplierId ,
276278) : DynamoDBRecord {
277279 const oldImage = Object . fromEntries (
278280 Object . entries ( oldLetter ) . map ( ( [ key , value ] ) => [ key , { S : value } ] ) ,
0 commit comments