Skip to content

Commit 68800ad

Browse files
committed
CCM-11889: improve test coverage
1 parent 3933b8c commit 68800ad

19 files changed

+379
-50
lines changed

frontend/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
public
22
amplify
3+
next-env.d.ts

lambdas/backend-api/src/__tests__/api/create-routing-config.test.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ describe('Create Routing Config Handler', () => {
6363

6464
const event = mock<APIGatewayProxyEvent>({
6565
requestContext: {
66-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
66+
authorizer: {
67+
internalUserId: 'user-1234',
68+
clientId: 'nhs-notify-client-id',
69+
},
6770
},
6871
body: undefined,
6972
});
@@ -101,7 +104,10 @@ describe('Create Routing Config Handler', () => {
101104

102105
const event = mock<APIGatewayProxyEvent>({
103106
requestContext: {
104-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
107+
authorizer: {
108+
internalUserId: 'user-1234',
109+
clientId: 'nhs-notify-client-id',
110+
},
105111
},
106112
body: JSON.stringify({ id: 1 }),
107113
});
@@ -156,7 +162,10 @@ describe('Create Routing Config Handler', () => {
156162

157163
const event = mock<APIGatewayProxyEvent>({
158164
requestContext: {
159-
authorizer: { internalUserId: 'user-1234', clientId: 'notify-client-id' },
165+
authorizer: {
166+
internalUserId: 'user-1234',
167+
clientId: 'notify-client-id',
168+
},
160169
},
161170
body: JSON.stringify(create),
162171
});

lambdas/backend-api/src/__tests__/api/create.test.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ describe('Template API - Create', () => {
6161

6262
const event = mock<APIGatewayProxyEvent>({
6363
requestContext: {
64-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
64+
authorizer: {
65+
internalUserId: 'user-1234',
66+
clientId: 'nhs-notify-client-id',
67+
},
6568
},
6669
body: undefined,
6770
});
@@ -99,7 +102,10 @@ describe('Template API - Create', () => {
99102

100103
const event = mock<APIGatewayProxyEvent>({
101104
requestContext: {
102-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
105+
authorizer: {
106+
internalUserId: 'user-1234',
107+
clientId: 'nhs-notify-client-id',
108+
},
103109
},
104110
body: JSON.stringify({ id: 1 }),
105111
});
@@ -143,7 +149,10 @@ describe('Template API - Create', () => {
143149

144150
const event = mock<APIGatewayProxyEvent>({
145151
requestContext: {
146-
authorizer: { internalUserId: 'user-1234', clientId: 'notify-client-id' },
152+
authorizer: {
153+
internalUserId: 'user-1234',
154+
clientId: 'notify-client-id',
155+
},
147156
},
148157
body: JSON.stringify(create),
149158
});

lambdas/backend-api/src/__tests__/api/delete-routing-config.test.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ describe('Delete Routing Config Handler', () => {
5252

5353
const event = mock<APIGatewayProxyEvent>({
5454
requestContext: {
55-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
55+
authorizer: {
56+
internalUserId: 'user-1234',
57+
clientId: 'nhs-notify-client-id',
58+
},
5659
},
5760
body: JSON.stringify({ name: 'test' }),
5861
pathParameters: { routingConfigId: undefined },
@@ -90,7 +93,10 @@ describe('Delete Routing Config Handler', () => {
9093

9194
const event = mock<APIGatewayProxyEvent>({
9295
requestContext: {
93-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
96+
authorizer: {
97+
internalUserId: 'user-1234',
98+
clientId: 'nhs-notify-client-id',
99+
},
94100
},
95101
pathParameters: { routingConfigId: '1-2-3' },
96102
headers: {
@@ -127,7 +133,10 @@ describe('Delete Routing Config Handler', () => {
127133

128134
const event = mock<APIGatewayProxyEvent>({
129135
requestContext: {
130-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
136+
authorizer: {
137+
internalUserId: 'user-1234',
138+
clientId: 'nhs-notify-client-id',
139+
},
131140
},
132141
pathParameters: { routingConfigId: '1-2-3' },
133142
headers: {
@@ -167,7 +176,10 @@ describe('Delete Routing Config Handler', () => {
167176

168177
const event = mock<APIGatewayProxyEvent>({
169178
requestContext: {
170-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
179+
authorizer: {
180+
internalUserId: 'user-1234',
181+
clientId: 'nhs-notify-client-id',
182+
},
171183
},
172184
pathParameters: { routingConfigId: '1-2-3' },
173185
headers: {},

lambdas/backend-api/src/__tests__/api/delete.test.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ describe('Template API - Delete', () => {
5050

5151
const event = mock<APIGatewayProxyEvent>({
5252
requestContext: {
53-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
53+
authorizer: {
54+
internalUserId: 'user-1234',
55+
clientId: 'nhs-notify-client-id',
56+
},
5457
},
5558
body: JSON.stringify({ name: 'test' }),
5659
pathParameters: { templateId: undefined },
@@ -86,7 +89,10 @@ describe('Template API - Delete', () => {
8689

8790
const event = mock<APIGatewayProxyEvent>({
8891
requestContext: {
89-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
92+
authorizer: {
93+
internalUserId: 'user-1234',
94+
clientId: 'nhs-notify-client-id',
95+
},
9096
},
9197
pathParameters: { templateId: '1-2-3' },
9298
headers: {
@@ -123,7 +129,10 @@ describe('Template API - Delete', () => {
123129

124130
const event = mock<APIGatewayProxyEvent>({
125131
requestContext: {
126-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
132+
authorizer: {
133+
internalUserId: 'user-1234',
134+
clientId: 'nhs-notify-client-id',
135+
},
127136
},
128137
pathParameters: { templateId: '1-2-3' },
129138
headers: {
@@ -163,7 +172,10 @@ describe('Template API - Delete', () => {
163172

164173
const event = mock<APIGatewayProxyEvent>({
165174
requestContext: {
166-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
175+
authorizer: {
176+
internalUserId: 'user-1234',
177+
clientId: 'nhs-notify-client-id',
178+
},
167179
},
168180
pathParameters: { templateId: '1-2-3' },
169181
headers: {},

lambdas/backend-api/src/__tests__/api/get-client-configuration.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ describe('Template API - get client configuration', () => {
6161

6262
const event = mock<APIGatewayProxyEvent>({
6363
requestContext: {
64-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
64+
authorizer: {
65+
internalUserId: 'user-1234',
66+
clientId: 'nhs-notify-client-id',
67+
},
6568
},
6669
});
6770

@@ -95,7 +98,10 @@ describe('Template API - get client configuration', () => {
9598

9699
const event = mock<APIGatewayProxyEvent>({
97100
requestContext: {
98-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
101+
authorizer: {
102+
internalUserId: 'user-1234',
103+
clientId: 'nhs-notify-client-id',
104+
},
99105
},
100106
});
101107

lambdas/backend-api/src/__tests__/api/get-routing-config.test.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ describe('GetRoutingConfig handler', () => {
5555

5656
const event = mock<APIGatewayProxyEvent>({
5757
requestContext: {
58-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
58+
authorizer: {
59+
internalUserId: 'user-1234',
60+
clientId: 'nhs-notify-client-id',
61+
},
5962
},
6063
pathParameters: { routingConfigId: undefined },
6164
});
@@ -87,7 +90,10 @@ describe('GetRoutingConfig handler', () => {
8790

8891
const event = mock<APIGatewayProxyEvent>({
8992
requestContext: {
90-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
93+
authorizer: {
94+
internalUserId: 'user-1234',
95+
clientId: 'nhs-notify-client-id',
96+
},
9197
},
9298
pathParameters: {
9399
routingConfigId: '3690d344-731f-4f60-9047-2c63c96623a2',
@@ -119,7 +125,10 @@ describe('GetRoutingConfig handler', () => {
119125

120126
const event = mock<APIGatewayProxyEvent>({
121127
requestContext: {
122-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
128+
authorizer: {
129+
internalUserId: 'user-1234',
130+
clientId: 'nhs-notify-client-id',
131+
},
123132
},
124133
pathParameters: {
125134
routingConfigId: '3690d344-731f-4f60-9047-2c63c96623a2',

lambdas/backend-api/src/__tests__/api/get.test.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ describe('Template API - Get', () => {
5050

5151
const event = mock<APIGatewayProxyEvent>({
5252
requestContext: {
53-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
53+
authorizer: {
54+
internalUserId: 'user-1234',
55+
clientId: 'nhs-notify-client-id',
56+
},
5457
},
5558
pathParameters: { templateId: undefined },
5659
});
@@ -82,7 +85,10 @@ describe('Template API - Get', () => {
8285

8386
const event = mock<APIGatewayProxyEvent>({
8487
requestContext: {
85-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
88+
authorizer: {
89+
internalUserId: 'user-1234',
90+
clientId: 'nhs-notify-client-id',
91+
},
8692
},
8793
pathParameters: { templateId: '1' },
8894
});
@@ -124,7 +130,10 @@ describe('Template API - Get', () => {
124130

125131
const event = mock<APIGatewayProxyEvent>({
126132
requestContext: {
127-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
133+
authorizer: {
134+
internalUserId: 'user-1234',
135+
clientId: 'nhs-notify-client-id',
136+
},
128137
},
129138
pathParameters: { templateId: '1' },
130139
});

lambdas/backend-api/src/__tests__/api/proof.test.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ describe('Template API - request proof', () => {
4949

5050
const event = mock<APIGatewayProxyEvent>({
5151
requestContext: {
52-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
52+
authorizer: {
53+
internalUserId: 'user-1234',
54+
clientId: 'nhs-notify-client-id',
55+
},
5356
},
5457
pathParameters: { templateId: undefined },
5558
headers: { 'X-Lock-Number': '0' },
@@ -82,7 +85,10 @@ describe('Template API - request proof', () => {
8285

8386
const event = mock<APIGatewayProxyEvent>({
8487
requestContext: {
85-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
88+
authorizer: {
89+
internalUserId: 'user-1234',
90+
clientId: 'nhs-notify-client-id',
91+
},
8692
},
8793
pathParameters: { templateId: 'template-id' },
8894
headers: { 'X-Lock-Number': '0' },
@@ -120,7 +126,10 @@ describe('Template API - request proof', () => {
120126

121127
const event = mock<APIGatewayProxyEvent>({
122128
requestContext: {
123-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
129+
authorizer: {
130+
internalUserId: 'user-1234',
131+
clientId: 'nhs-notify-client-id',
132+
},
124133
},
125134
pathParameters: { templateId: 'template-id' },
126135
headers: {},
@@ -177,7 +186,10 @@ describe('Template API - request proof', () => {
177186

178187
const event = mock<APIGatewayProxyEvent>({
179188
requestContext: {
180-
authorizer: { internalUserId: 'user-1234', clientId: 'notify-client-id' },
189+
authorizer: {
190+
internalUserId: 'user-1234',
191+
clientId: 'notify-client-id',
192+
},
181193
},
182194
pathParameters: { templateId: 'id' },
183195
headers: { 'X-Lock-Number': '0' },

lambdas/backend-api/src/__tests__/api/submit-routing-config.test.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ describe('Submit Routing Config Handler', () => {
5454

5555
const event = mock<APIGatewayProxyEvent>({
5656
requestContext: {
57-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
57+
authorizer: {
58+
internalUserId: 'user-1234',
59+
clientId: 'nhs-notify-client-id',
60+
},
5861
},
5962
body: JSON.stringify({ name: 'test' }),
6063
pathParameters: { routingConfigId: undefined },
@@ -92,7 +95,10 @@ describe('Submit Routing Config Handler', () => {
9295

9396
const event = mock<APIGatewayProxyEvent>({
9497
requestContext: {
95-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
98+
authorizer: {
99+
internalUserId: 'user-1234',
100+
clientId: 'nhs-notify-client-id',
101+
},
96102
},
97103
pathParameters: { routingConfigId: '1-2-3' },
98104
headers: {
@@ -131,7 +137,10 @@ describe('Submit Routing Config Handler', () => {
131137

132138
const event = mock<APIGatewayProxyEvent>({
133139
requestContext: {
134-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
140+
authorizer: {
141+
internalUserId: 'user-1234',
142+
clientId: 'nhs-notify-client-id',
143+
},
135144
},
136145
pathParameters: { routingConfigId: '1-2-3' },
137146
headers: {
@@ -171,7 +180,10 @@ describe('Submit Routing Config Handler', () => {
171180

172181
const event = mock<APIGatewayProxyEvent>({
173182
requestContext: {
174-
authorizer: { internalUserId: 'user-1234', clientId: 'nhs-notify-client-id' },
183+
authorizer: {
184+
internalUserId: 'user-1234',
185+
clientId: 'nhs-notify-client-id',
186+
},
175187
},
176188
pathParameters: { routingConfigId: '1-2-3' },
177189
headers: {},

0 commit comments

Comments
 (0)