@@ -167,7 +167,6 @@ describe("helpers.ts", () => {
167167
168168 // Only QueryCommand should be called
169169 expect ( sendSpy ) . toHaveBeenCalledTimes ( 1 )
170- expect ( sendSpy ) . toHaveBeenCalledWith ( expect . any ( QueryCommand ) )
171170 // Warning logged
172171 expect ( logger . warn ) . toHaveBeenCalledWith (
173172 "No matching record found for NotifyMessageID. Counting this as a successful update." ,
@@ -205,20 +204,17 @@ describe("helpers.ts", () => {
205204
206205 await updateNotificationsTable ( logger , mockResponse )
207206
208- expect ( sendSpy ) . toHaveBeenCalledWith ( expect . any ( QueryCommand ) )
209- expect ( sendSpy ) . toHaveBeenCalledWith (
210- expect . objectContaining ( {
211- input : expect . objectContaining ( {
212- TableName : process . env . TABLE_NAME ,
213- Key : { NHSNumber : mockItem . NHSNumber , ODSCode : mockItem . ODSCode } ,
214- ExpressionAttributeValues : {
215- ":ds" : mockResponse . data [ 0 ] . attributes . messageStatus ,
216- ":ts" : overrideTimestamp ,
217- ":et" : Math . floor ( 100_000_000 / 1000 ) + 60 * 60 * 24 * 7
218- }
219- } )
220- } )
221- )
207+ const [ updateCmd ] = sendSpy . mock . calls [ 1 ]
208+ expect ( ( updateCmd ) . input ) . toMatchObject ( {
209+ TableName : process . env . TABLE_NAME ,
210+ Key : { NHSNumber : mockItem . NHSNumber , ODSCode : mockItem . ODSCode } ,
211+ ExpressionAttributeValues : {
212+ ":ds" : mockResponse . data [ 0 ] . attributes . messageStatus ,
213+ ":ts" : overrideTimestamp ,
214+ ":et" : Math . floor ( 100_000_000 / 1000 ) + 60 * 60 * 24 * 7
215+ }
216+ } )
217+
222218 expect ( logger . info ) . toHaveBeenCalledWith (
223219 "Updated notification state" ,
224220 expect . objectContaining ( {
@@ -336,8 +332,8 @@ describe("helpers.ts", () => {
336332 const { fetchSecrets : fn } = await import ( "../src/helpers" )
337333 await expect ( fn ( logger ) ) . resolves . toBeUndefined ( )
338334
339- expect ( mockGetSecret ) . toHaveBeenCalledWith ( process . env . APP_NAME_SECRET )
340- expect ( mockGetSecret ) . toHaveBeenCalledWith ( process . env . API_KEY_SECRET )
335+ expect ( mockGetSecret ) . toHaveBeenCalledWith ( process . env . APP_NAME_SECRET ! )
336+ expect ( mockGetSecret ) . toHaveBeenCalledWith ( process . env . API_KEY_SECRET ! )
341337 } )
342338 } )
343339} )
0 commit comments