Skip to content

CCM-17208: Supplier API Pact tests#319

Open
simonlabarere wants to merge 12 commits intomainfrom
feature/CCM-17208_Supplier_api_pact_tests
Open

CCM-17208: Supplier API Pact tests#319
simonlabarere wants to merge 12 commits intomainfrom
feature/CCM-17208_Supplier_api_pact_tests

Conversation

@simonlabarere
Copy link
Copy Markdown
Contributor

@simonlabarere simonlabarere commented Apr 28, 2026

Description

Consumer side pact tests for events produced by the Supplier API and consumed by Digital Letters:

  • Added pact tests
  • Updated print-status-handler to stop using the Supplier Event as a base for the Digital Letter event
  • Updated scripts/tests/contract.sh to check that the latest version of the @nhsdigital/nhs-notify-event-schemas-supplier-api package is used
  • Updated @nhsdigital/nhs-notify-event-schemas-supplier-api to the latest version (1.18.0)

Provider side of the tests: NHSDigital/nhs-notify-supplier-api#557

Testing

image image

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming

Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

@simonlabarere simonlabarere requested a review from a team as a code owner April 28, 2026 13:02
@simonlabarere simonlabarere force-pushed the feature/CCM-17208_Supplier_api_pact_tests branch from 601eb22 to 5b667d8 Compare April 28, 2026 13:04
@simonlabarere simonlabarere added the enhancement New feature or request label Apr 28, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds consumer-side Pact coverage for Supplier API letter status events and updates the print-status-handler to transform Supplier events into Digital Letters print.letter.transitioned events without reusing the Supplier event as a base.

Changes:

  • Added Supplier API Pact consumer + provider verification tests using Supplier schema example payloads.
  • Updated print-status-handler to validate/consume a new utils Zod shape and construct Digital Letters events explicitly.
  • Updated contract test script to enforce up-to-date schema packages; adjusted schema package dependency ranges.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
utils/utils/src/types/supplier-api-letter-event.ts Introduces a new Zod schema/type used to validate Supplier API letter events (partial shape).
utils/utils/src/types/index.ts Exports the new Supplier API event schema/type.
lambdas/print-status-handler/src/apis/sqs-handler.ts Switches validation away from supplier schema types and rebuilds the outgoing Digital Letters event explicitly.
lambdas/print-status-handler/src/tests/test-data.ts Updates test typings to LetterStatusChangeEvent.
lambdas/print-status-handler/src/tests/apis/sqs-handler.test.ts Adjusts unit test expectations to match the new event construction behavior.
tests/playwright/digital-letters-component-tests/print-status-handler.component.spec.ts Updates component test typing/generics for publishing Supplier API events.
tests/pact-tests/consumer/supplier-api.consumer.pact.test.ts Adds Pact consumer tests for Supplier API letter status messages.
tests/pact-tests/pact-verification/supplier-api.provider.pact.test.ts Adds provider-side Pact verification wired to schema example messages.
tests/pact-tests/package.json Adds supplier-api schema package dependency for pact tests.
tests/playwright/package.json Adjusts supplier-api schema package dependency range.
scripts/tests/contract.sh Extends schema “outdated” checks to include supplier-api schemas.
lambdas/print-status-handler/package.json Updates supplier-api schema dependency range.
package-lock.json Updates lockfile to reflect dependency changes and resolved versions.

Comment thread lambdas/print-status-handler/src/apis/sqs-handler.ts
Comment thread lambdas/print-status-handler/src/apis/sqs-handler.ts
Comment thread utils/utils/src/types/supplier-api-letter-event.ts
Comment thread tests/playwright/package.json
Comment thread tests/pact-tests/package.json
Comment thread lambdas/print-status-handler/package.json
Comment thread lambdas/print-status-handler/package.json Outdated
Comment thread utils/utils/src/types/supplier-api-letter-event.ts Outdated
Comment thread lambdas/print-status-handler/src/__tests__/apis/sqs-handler.test.ts Outdated
Comment thread tests/pact-tests/pact-verification/supplier-api.provider.pact.test.ts Outdated
Comment thread tests/pact-tests/consumer/supplier-api.consumer.pact.test.ts Outdated
@simonlabarere simonlabarere force-pushed the feature/CCM-17208_Supplier_api_pact_tests branch from c35530d to fb5ff7b Compare April 30, 2026 13:37
Comment thread tests/pact-tests/consumer/supplier-api.consumer.pact.test.ts Outdated
Comment thread tests/pact-tests/consumer/supplier-api.consumer.pact.test.ts Outdated
Comment thread tests/pact-tests/consumer/supplier-api.consumer.pact.test.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants