generated from NHSDigital/nhs-notify-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhelpers.ts
More file actions
67 lines (60 loc) · 1.72 KB
/
helpers.ts
File metadata and controls
67 lines (60 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { mockDeep } from 'jest-mock-extended';
import { TemplateDto } from 'nhs-notify-backend-client';
function* iteratorFromList<T>(list: T[]): IterableIterator<T> {
for (const item of list) {
yield item;
}
}
export const getMockFormData = (formData: Record<string, string>) =>
mockDeep<FormData>({
entries: jest.fn().mockImplementation(() => {
const formDataEntries = Object.entries(formData);
return iteratorFromList(formDataEntries);
}),
get: (key: string) => formData[key],
});
export const NHS_APP_TEMPLATE: TemplateDto = {
id: 'template-id',
templateType: 'NHS_APP',
templateStatus: 'NOT_YET_SUBMITTED',
name: 'name',
message: 'message',
createdAt: '2025-01-13T10:19:25.579Z',
updatedAt: '2025-01-13T10:19:25.579Z',
} as const;
export const EMAIL_TEMPLATE: TemplateDto = {
id: 'template-id',
templateType: 'EMAIL',
templateStatus: 'NOT_YET_SUBMITTED',
name: 'name',
message: 'message',
subject: 'subject',
createdAt: '2025-01-13T10:19:25.579Z',
updatedAt: '2025-01-13T10:19:25.579Z',
} as const;
export const SMS_TEMPLATE: TemplateDto = {
id: 'template-id',
templateType: 'SMS',
templateStatus: 'NOT_YET_SUBMITTED',
name: 'name',
message: 'message',
createdAt: '2025-01-13T10:19:25.579Z',
updatedAt: '2025-01-13T10:19:25.579Z',
} as const;
export const LETTER_TEMPLATE: TemplateDto = {
id: 'template-id',
templateType: 'LETTER',
templateStatus: 'NOT_YET_SUBMITTED',
letterType: 'x0',
language: 'en',
files: {
pdfTemplate: {
fileName: 'template.pdf',
currentVersion: '8ADED236B5AE',
virusScanStatus: 'PASSED',
},
},
name: 'name',
createdAt: '2025-01-13T10:19:25.579Z',
updatedAt: '2025-01-13T10:19:25.579Z',
} as const;