File tree Expand file tree Collapse file tree
tests/contracts/provider/__tests__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { MessageProviderPact } from "@pact-foundation/pact" ;
22import {
3- getAllLetterStatuses ,
3+ LETTER_STATUSES ,
44 getMessageProviderForStatus ,
55 getPactUrlForStatus ,
66} from "./utils/utils" ;
77
88const CONSUMER_PACKAGE = "@nhsdigital/notify-core-consumer-contracts" ;
99
1010describe ( "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 ( ) } ` ,
Original file line number Diff line number Diff line change 11import path from "node:path" ;
22import 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
5354export function getAllLetterStatuses ( ) : readonly LetterStatus [ ] {
You can’t perform that action at this time.
0 commit comments