@@ -11,7 +11,7 @@ describe('API Lambda handler', () => {
1111 it ( 'passes if S3 and DynamoDB are available' , async ( ) => {
1212
1313 const event = makeApiGwEvent ( { path : '/_status' ,
14- headers : { 'Nhsd-Correlation-Id' : 'correlationId' }
14+ headers : undefined
1515 } ) ;
1616
1717 const getLetterDataHandler = createGetStatusHandler ( getMockedDeps ( ) ) ;
@@ -28,14 +28,15 @@ describe('API Lambda handler', () => {
2828 mockedDeps . s3Client . send = jest . fn ( ) . mockRejectedValue ( new Error ( 'unexpected error' ) ) ;
2929
3030 const event = makeApiGwEvent ( { path : '/_status' ,
31- headers : { 'Nhsd-Correlation-Id' : 'correlationId' }
31+ headers : undefined
3232 } ) ;
3333
3434 const getLetterDataHandler = createGetStatusHandler ( mockedDeps ) ;
3535 const result = await getLetterDataHandler ( event , mockDeep < Context > ( ) , jest . fn ( ) ) ;
3636
37- expect ( result ! . statusCode ) . toBe ( 500 ) ;
38- expect ( JSON . parse ( result ! . body ) . errors [ 0 ] . id ) . toBe ( 'correlationId' ) ;
37+ expect ( result ) . toEqual ( expect . objectContaining ( {
38+ statusCode : 500
39+ } ) ) ;
3940 } ) ;
4041
4142
@@ -50,24 +51,11 @@ describe('API Lambda handler', () => {
5051 const getLetterDataHandler = createGetStatusHandler ( mockedDeps ) ;
5152 const result = await getLetterDataHandler ( event , mockDeep < Context > ( ) , jest . fn ( ) ) ;
5253
53- expect ( result ! . statusCode ) . toBe ( 500 ) ;
54- expect ( JSON . parse ( result ! . body ) . errors [ 0 ] . id ) . toBe ( 'correlationId' ) ;
54+ expect ( result ) . toEqual ( expect . objectContaining ( {
55+ statusCode : 500
56+ } ) ) ;
5557 } ) ;
5658
57- it ( 'allows the correlation ID to be absent' , async ( ) => {
58- const mockedDeps = getMockedDeps ( ) ;
59- mockedDeps . dbHealthcheck . check = jest . fn ( ) . mockRejectedValue ( new Error ( 'unexpected error' ) ) ;
60-
61- const event = makeApiGwEvent ( { path : '/_status' ,
62- headers : { }
63- } ) ;
64-
65- const getLetterDataHandler = createGetStatusHandler ( mockedDeps ) ;
66- const result = await getLetterDataHandler ( event , mockDeep < Context > ( ) , jest . fn ( ) ) ;
67-
68- expect ( result ! . statusCode ) . toBe ( 500 ) ;
69- expect ( JSON . parse ( result ! . body ) . errors [ 0 ] . id ) . toBeDefined ( ) ;
70- } ) ;
7159
7260 function getMockedDeps ( ) : jest . Mocked < Deps > {
7361 return {
0 commit comments