-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsupplier-api.digital-letters.provider.pact.test.ts
More file actions
44 lines (42 loc) · 2.71 KB
/
supplier-api.digital-letters.provider.pact.test.ts
File metadata and controls
44 lines (42 loc) · 2.71 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
import path from 'node:path';
import { MessageProviderPact } from '@pact-foundation/pact';
import LetterAcceptedEvent from '@nhsdigital/nhs-notify-event-schemas-supplier-api/schemas/examples/letter.ACCEPTED.json';
import LetterCancelledEvent from '@nhsdigital/nhs-notify-event-schemas-supplier-api/schemas/examples/letter.CANCELLED.json';
import LetterDeliveredEvent from '@nhsdigital/nhs-notify-event-schemas-supplier-api/schemas/examples/letter.DELIVERED.json';
import LetterDispatchedEvent from '@nhsdigital/nhs-notify-event-schemas-supplier-api/schemas/examples/letter.DISPATCHED.json';
import LetterEnclosedEvent from '@nhsdigital/nhs-notify-event-schemas-supplier-api/schemas/examples/letter.ENCLOSED.json';
import LetterFailedEvent from '@nhsdigital/nhs-notify-event-schemas-supplier-api/schemas/examples/letter.FAILED.json';
import LetterForwardedEvent from '@nhsdigital/nhs-notify-event-schemas-supplier-api/schemas/examples/letter.FORWARDED.json';
import LetterPendingEvent from '@nhsdigital/nhs-notify-event-schemas-supplier-api/schemas/examples/letter.PENDING.json';
import LetterPrintedEvent from '@nhsdigital/nhs-notify-event-schemas-supplier-api/schemas/examples/letter.PRINTED.json';
import LetterRejectedEvent from '@nhsdigital/nhs-notify-event-schemas-supplier-api/schemas/examples/letter.REJECTED.json';
import LetterReturnedEvent from '@nhsdigital/nhs-notify-event-schemas-supplier-api/schemas/examples/letter.RETURNED.json';
describe('Supplier API -> Digital Letters pact tests', () => {
test('verify pacts', async () => {
const p = new MessageProviderPact({
provider: 'ssupplier-api',
pactUrls: [
path.join(
__dirname,
'../../../node_modules',
'@nhsdigital/notify-digital-letters-consumer-contracts/pacts/supplier-api/digital-letters-supplier-api.json'
),
],
messageProviders: {
'SupplierApiEvent-letter_accepted': () => LetterAcceptedEvent,
'SupplierApiEvent-letter_cancelled': () => LetterCancelledEvent,
'SupplierApiEvent-letter_delivered': () => LetterDeliveredEvent,
'SupplierApiEvent-letter_dispatched': () => LetterDispatchedEvent,
'SupplierApiEvent-letter_enclosed': () => LetterEnclosedEvent,
'SupplierApiEvent-letter_failed': () => LetterFailedEvent,
'SupplierApiEvent-letter_forwarded': () => LetterForwardedEvent,
'SupplierApiEvent-letter_pending': () => LetterPendingEvent,
'SupplierApiEvent-letter_printed': () => LetterPrintedEvent,
'SupplierApiEvent-letter_rejected': () => LetterRejectedEvent,
'SupplierApiEvent-letter_returned': () => LetterReturnedEvent,
},
logLevel: 'error',
});
await expect(p.verify()).resolves.not.toThrow();
}, 60_000);
});