Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"@aws-sdk/client-lambda": "^3.986.0",
"@aws-sdk/client-sns": "^3.984.0",
"@aws-sdk/lib-dynamodb": "^3.1008.0",
"@nhsdigital/nhs-notify-event-schemas-letter-rendering": "2.0.1",
"@nhsdigital/nhs-notify-event-schemas-letter-rendering": "^2.0.1",
"@nhsdigital/notify-digital-letters-consumer-contracts": "^1.0.1",
"@pact-foundation/pact": "^16.0.4",
"@pact-foundation/pact-core": "^17.1.0",
"@playwright/test": "^1.57.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,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',
Comment thread
gareth-allan marked this conversation as resolved.
Outdated
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);
});
1 change: 1 addition & 0 deletions tests/pact-tests/run-pact-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -euo pipefail

# Ensure we have the latest package matching the major version
npm install --no-lockfile @nhsdigital/nhs-notify-event-schemas-letter-rendering@^2
npm install --no-lockfile @nhsdigital/notify-digital-letters-consumer-contracts@^1

# Reinstall pact to ensure platform-specific native dependencies are present
# CI may run on a different architectures to local dev
Expand Down
Loading