Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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 .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"jest.config.ts",
"jest.setup.ts",
"**/__tests__/**",
"**/*.dev.[jt]s?(x)"
"**/*.dev.[jt]s?(x)",
"**/*.test.[jt]s?(x)"
]
}
],
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/stage-2-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,67 @@ jobs:
sonar_organisation_key: "${{ vars.SONAR_ORGANISATION_KEY }}"
sonar_project_key: "${{ vars.SONAR_PROJECT_KEY }}"
sonar_token: "${{ secrets.SONAR_TOKEN }}"

consumer-contracts:
name: Consumer Contract Tests
runs-on: ubuntu-latest
environment: dev
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
run: npm ci

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ASSUME_ROLE_NAME }}
role-session-name: templates-ci-contract-tests
aws-region: ${{ env.AWS_REGION }}

- name: Download golden contracts from providers
run: |
export PACT_BUCKET="nhs-notify-${{ secrets.AWS_ACCOUNT_ID }}-${{ env.AWS_REGION }}-main-acct-artefacts"
npm run test:contracts:download:provider

- name: Validate consumer examples against golden contracts
run: npm run test:contracts:consumer:golden

- name: Run consumer contract tests
run: npm run test:contracts:consumer

- name: Upload consumer Pact files
run: |
export PACT_BUCKET="nhs-notify-${{ secrets.AWS_ACCOUNT_ID }}-${{ env.AWS_REGION }}-main-acct-artefacts"
npm run test:contracts:upload:consumer

- name: Upload Pact contracts as artifacts
uses: actions/upload-artifact@v4
with:
name: consumer-pacts
path: tests/contracts/tests/*/consumer/pacts/*.json
if-no-files-found: warn

provider-contracts:
name: Provider Contract Tests
runs-on: ubuntu-latest
environment: dev
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
run: npm ci

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ASSUME_ROLE_NAME }}
role-session-name: templates-ci-contract-tests
aws-region: ${{ env.AWS_REGION }}

- name: Download consumer generated Pact files and run provider contract tests
run: |
export PACT_BUCKET="nhs-notify-${{ secrets.AWS_ACCOUNT_ID }}-${{ env.AWS_REGION }}-main-acct-artefacts"
npm run test:contracts:provider:ci
Loading
Loading