Skip to content

Commit b166469

Browse files
committed
add cleanup utils
1 parent 11f61f1 commit b166469

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

tests/contracts/provider/__tests__/letter-status.provider.pact.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
import { MessageProviderPact } from "@pact-foundation/pact";
22
import {
3-
getAllLetterStatuses,
3+
LETTER_STATUSES,
44
getMessageProviderForStatus,
55
getPactUrlForStatus,
66
} from "./utils/utils";
77

88
const CONSUMER_PACKAGE = "@nhsdigital/notify-core-consumer-contracts";
99

1010
describe("Supplier API letter status provider tests", () => {
11-
const statuses = getAllLetterStatuses();
12-
13-
describe.each(statuses)("letter.%s event", (status) => {
11+
describe.each(LETTER_STATUSES)("letter.%s event", (status) => {
1412
test(`verifies letter-${status.toLowerCase()} pact`, async () => {
1513
const p = new MessageProviderPact({
1614
provider: `letter-${status.toLowerCase()}`,

tests/contracts/provider/__tests__/utils/utils.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from "node:path";
22
import fs from "node:fs";
33

4-
const LETTER_STATUSES = [
4+
export const LETTER_STATUSES = [
55
"ACCEPTED",
66
"CANCELLED",
77
"DELIVERED",
@@ -40,14 +40,15 @@ export function getPactUrlForStatus(
4040
consumerPackage: string,
4141
status: LetterStatus,
4242
): string {
43-
const contractsDir = path.join(
43+
return path.join(
4444
__dirname,
45-
"../../.contracts",
45+
"../../",
46+
".contracts",
4647
consumerPackage,
47-
"pacts/supplier-api",
48+
"pacts",
49+
"supplier-api",
50+
`core-letter-${status.toLowerCase()}.json`,
4851
);
49-
50-
return path.join(contractsDir, `core-letter-${status.toLowerCase()}.json`);
5152
}
5253

5354
export function getAllLetterStatuses(): readonly LetterStatus[] {

0 commit comments

Comments
 (0)