Skip to content

Commit 1fd9a90

Browse files
committed
CCM-10483: fix linting
1 parent 15df883 commit 1fd9a90

File tree

5 files changed

+63
-60
lines changed

5 files changed

+63
-60
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
"jest.config.ts",
6969
"jest.setup.ts",
7070
"**/__tests__/**",
71-
"**/*.dev.[jt]s?(x)"
71+
"**/*.dev.[jt]s?(x)",
72+
"**/*.test.[jt]s?(x)"
7273
]
7374
}
7475
],

.github/workflows/stage-2-test.yaml

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -153,59 +153,3 @@ jobs:
153153
sonar_organisation_key: "${{ vars.SONAR_ORGANISATION_KEY }}"
154154
sonar_project_key: "${{ vars.SONAR_PROJECT_KEY }}"
155155
sonar_token: "${{ secrets.SONAR_TOKEN }}"
156-
157-
158-
consumer-contracts:
159-
name: Consumer Contract Tests
160-
runs-on: ubuntu-latest
161-
steps:
162-
- name: Checkout repository
163-
uses: actions/checkout@v4
164-
165-
- name: Install dependencies
166-
run: npm ci
167-
168-
- name: Configure AWS credentials
169-
uses: aws-actions/configure-aws-credentials@v4
170-
with:
171-
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ASSUME_ROLE_NAME }}
172-
role-session-name: templates-ci-contract-tests
173-
aws-region: ${{ env.AWS_REGION }}
174-
175-
- name: Run consumer contract tests
176-
run: npm run test:contracts:consumers
177-
178-
- name: Upload consumer Pact files
179-
run: |
180-
export PACT_BUCKET="nhs-notify-${{ secrets.AWS_ACCOUNT_ID }}-${{ env.AWS_REGION }}-main-acct-artefacts"
181-
npm run test:contracts:upload:consumer
182-
183-
- name: Upload Pact contracts as artifacts
184-
uses: actions/upload-artifact@v4
185-
with:
186-
name: consumer-pacts
187-
path: tests/contracts/tests/*/consumer/pacts/*.json
188-
if-no-files-found: warn
189-
190-
191-
provider-contracts:
192-
name: Provider Contract Tests
193-
runs-on: ubuntu-latest
194-
steps:
195-
- name: Checkout repository
196-
uses: actions/checkout@v4
197-
198-
- name: Install dependencies
199-
run: npm ci
200-
201-
- name: Configure AWS credentials
202-
uses: aws-actions/configure-aws-credentials@v4
203-
with:
204-
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ASSUME_ROLE_NAME }}
205-
role-session-name: templates-ci-contract-tests
206-
aws-region: ${{ env.AWS_REGION }}
207-
208-
- name: Download consumer generated Pact files and run provider contract tests
209-
run: |
210-
export PACT_BUCKET="nhs-notify-${{ secrets.AWS_ACCOUNT_ID }}-${{ env.AWS_REGION }}-main-acct-artefacts"
211-
npm run test:contracts:provider:ci

.github/workflows/stage-4-acceptance.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,57 @@ jobs:
254254
- name: "Destroy Backend sandbox"
255255
run: |
256256
npm run destroy-backend-sandbox ${{ steps.normalize_branch_name.outputs.normalized_branch_name }}
257+
258+
consumer-contracts:
259+
name: Consumer Contract Tests
260+
runs-on: ubuntu-latest
261+
steps:
262+
- name: Checkout repository
263+
uses: actions/checkout@v4
264+
265+
- name: Install dependencies
266+
run: npm ci
267+
268+
- name: Configure AWS credentials
269+
uses: aws-actions/configure-aws-credentials@v4
270+
with:
271+
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ASSUME_ROLE_NAME }}
272+
role-session-name: templates-ci-contract-tests
273+
aws-region: ${{ env.AWS_REGION }}
274+
275+
- name: Run consumer contract tests
276+
run: npm run test:contracts:consumers
277+
278+
- name: Upload consumer Pact files
279+
run: |
280+
export PACT_BUCKET="nhs-notify-${{ secrets.AWS_ACCOUNT_ID }}-${{ env.AWS_REGION }}-main-acct-artefacts"
281+
npm run test:contracts:upload:consumer
282+
283+
- name: Upload Pact contracts as artifacts
284+
uses: actions/upload-artifact@v4
285+
with:
286+
name: consumer-pacts
287+
path: tests/contracts/tests/*/consumer/pacts/*.json
288+
if-no-files-found: warn
289+
290+
provider-contracts:
291+
name: Provider Contract Tests
292+
runs-on: ubuntu-latest
293+
steps:
294+
- name: Checkout repository
295+
uses: actions/checkout@v4
296+
297+
- name: Install dependencies
298+
run: npm ci
299+
300+
- name: Configure AWS credentials
301+
uses: aws-actions/configure-aws-credentials@v4
302+
with:
303+
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ASSUME_ROLE_NAME }}
304+
role-session-name: templates-ci-contract-tests
305+
aws-region: ${{ env.AWS_REGION }}
306+
307+
- name: Download consumer generated Pact files and run provider contract tests
308+
run: |
309+
export PACT_BUCKET="nhs-notify-${{ secrets.AWS_ACCOUNT_ID }}-${{ env.AWS_REGION }}-main-acct-artefacts"
310+
npm run test:contracts:provider:ci

tests/contracts/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010
"name": "contract-tests",
1111
"private": true,
1212
"scripts": {
13+
"lint": "eslint .",
14+
"lint:fix": "eslint . --fix",
1315
"pact:clean": "./scripts/clean.sh",
1416
"pact:download:consumer": "./scripts/download-consumer-pacts.sh",
1517
"pact:upload:consumer": "./scripts/upload-consumer-pacts.sh",
1618
"test:consumers": "jest consumer.pact.test.ts",
1719
"test:provider": "jest provider.pact.test.ts",
18-
"test:provider:ci": "./scripts/ci-verify-provider.sh"
20+
"test:provider:ci": "./scripts/ci-verify-provider.sh",
21+
"test:unit": "echo 'No unit tests required'",
22+
"typecheck": "tsc --noEmit"
1923
},
2024
"version": "1.0.0"
2125
}

tests/contracts/tests/templates/provider/template-deleted.provider.pact.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import path from 'node:path';
33
import { MessageProviderPact } from '@pact-foundation/pact';
44

55
// This would be the actual function that produces the event payload in the producer source code
6-
function produceTemplateDeletedEvent(): any {
6+
function createTemplateDeletedEvent() {
77
return {
88
'detail-type': 'TemplateDeleted',
99
source: 'uk.nhs.notify.templates',
@@ -26,7 +26,7 @@ describe('Pact Message Provider - TemplateDeleted Event', () => {
2626
.filter((f) => f.endsWith('.json'))
2727
.map((f) => path.join(pactDir, f)),
2828
messageProviders: {
29-
TemplateDeleted: () => produceTemplateDeletedEvent(),
29+
TemplateDeleted: () => createTemplateDeletedEvent(),
3030
},
3131
logLevel: 'error',
3232
});

0 commit comments

Comments
 (0)