Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe("Message provider tests", () => {
const p = new MessageProviderPact({
messageProviders: {
"a request for a dog": () => createDog(27),
},
stateHandlers: {
"some state": () => {
// TODO: prepare system useful in order to create a dog
console.log('State handler: setting up "some state" for interaction')
return Promise.resolve(`state set to create a dog`)
},
},
consumer: "MyJSMessageConsumer",
log: path.resolve(process.cwd(), "logs"),
logLevel: "info",
provider: "MyJSMessageProvider",
providerVersion: "1.0.0",
describe("message producer", () => {
const messagePact = new MessageProviderPact({
messageProviders: {
"a hero created message": () => CreateHeroEventProducer.produceHeroCreatedEvent(),
},
log: path.resolve(process.cwd(), "logs", "pact.log"),
logLevel: "info",
provider: "node-message-provider",
pactUrls: [path.resolve(process.cwd(), "pacts", "node-message-consumer-node-message-provider.json")],
// Pact seems not to load a pact file from a pact broker, so we have to make do with the local pact file
// see https://github.com/pact-foundation/pact-js/issues/248
// pactBrokerUrl: "https://adesso.pact.dius.com.au",
// pactBrokerUsername: process.env.PACT_USERNAME,
// pactBrokerPassword: process.env.PACT_PASSWORD,
// publishVerificationResult: true,
// providerVersion: '1.0.0',
describe("Message provider tests", () => {
const p = new MessageProviderPact({
messageProviders: {
"a request to save an event": () => createEvent(),
},
logLevel: "WARN",
provider: "SNSPactEventProvider",
providerVersion: "1.0.0",
// For local validation
// pactUrls: [path.resolve(process.cwd(), "pacts", "snspacteventconsumer-snspacteventprovider.json")],
// Uncomment to use the broker
pactBrokerUrl: "https://test.pact.dius.com.au/",
pactBrokerUsername: "dXfltyFMgNOFZAxr8io9wJ37iUpY42M",
pactBrokerPassword: "O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1",
publishVerificationResult: true,