diff --git a/backend/api/tests/contract-tests/package.json b/backend/api/tests/contract-tests/package.json index 91647008d..9deb1e67e 100644 --- a/backend/api/tests/contract-tests/package.json +++ b/backend/api/tests/contract-tests/package.json @@ -9,7 +9,7 @@ "build": "npm run buildts && npm run buildjs", "publish": "node dist/provider/publish.js", "test": "npm run publish && jest", - "test:pact": "jest" + "test:pact": "jest --detectOpenHandles -runInBand" }, "author": "", "license": "ISC", diff --git a/backend/api/tests/contract-tests/tests/testClientRegistryContract.spec.ts b/backend/api/tests/contract-tests/tests/testClientRegistryContract.spec.ts index f0d5f9930..f24645b44 100644 --- a/backend/api/tests/contract-tests/tests/testClientRegistryContract.spec.ts +++ b/backend/api/tests/contract-tests/tests/testClientRegistryContract.spec.ts @@ -8,22 +8,19 @@ import {clientRegistryResponse} from "../../../src/handlers/types/client-registr import {mockLambdaContext} from "../../handlers/utils"; import {updateClientInRegistryHandler, UpdateClientPayload} from "../../../src/handlers/auth/update-client"; -beforeAll((): void => { - jest.setTimeout(200000); -}); - describe("ClientRegistryProvider", () => { const {like} = MatchersV3; - const provider = new PactV3({ - dir: path.resolve(process.cwd(), "pacts"), - logLevel: "debug", - port: 8080, - consumer: "SSEAdminAPIClient", - provider: "ClientRegistryProvider" - }); - describe("When a POST request is made to create a client", () => { + const provider = new PactV3({ + dir: path.resolve(process.cwd(), "pacts"), + logLevel: "debug", + port: 8080, + host: "127.0.0.1", + consumer: "SSEAdminAPIClient", + provider: "ClientRegistryProvider" + }); + const postEvent: RegisterClientPayload = { contactEmail: "pacttest.account@digital.cabinet-office.gov.uk", service: { @@ -88,6 +85,15 @@ describe("ClientRegistryProvider", () => { }); describe("When a PUT request is made to update a client", () => { + const provider = new PactV3({ + dir: path.resolve(process.cwd(), "pacts"), + logLevel: "debug", + port: 8081, + host: "127.0.0.1", + consumer: "SSEAdminAPIClient", + provider: "ClientRegistryProvider" + }); + const updatesForClient = { contacts: ["new.email@digital.cabinet-office.gov.uk"], subject_type: "pairwise" diff --git a/package.json b/package.json index 462c50985..cd7ae2557 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,8 @@ "list": "infrastructure/dev/deploy.sh list", "open": "infrastructure/dev/deploy.sh open", "creds": "infrastructure/aws.sh", - "test": "jest --silent", - "test:cov": "jest --silent --coverage", + "test": "jest --runInBand", + "test:cov": "jest --coverage", "lint": "prettier . --check ; eslint '*.ts' --quiet --fix", "lint:fix": "prettier . --write ; eslint . --fix", "pii-scan": "infrastructure/dev/pii_scan.sh -p *template*.yml -i infrastructure/config/pii_scan_ignore.txt -s infrastructure/config/pii_scan_skip.txt"