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 consumer", () => {
const messagePact = new MessageConsumerPact({
consumer: "node-message-consumer",
provider: "node-message-provider",
dir: path.resolve(process.cwd(), "pacts"),
pactfileWriteMode: "update",
logLevel: "info",
});
describe("'hero created' message Handler", () => {
it("should accept a valid hero created message", (done) => {
messagePact
.expectsToReceive("a hero created message")
.withContent({
id: Matchers.like(42),
name: Matchers.like("Superman"),
superpower: Matchers.like("flying"),
describe("Serverless consumer tests", () => {
const messagePact = new MessageConsumerPact({
consumer: "SNSPactEventConsumer",
dir: path.resolve(process.cwd(), "pacts"),
provider: "SNSPactEventProvider",
})
describe("receive a pact event", () => {
it("accepts a valid event", () => {
return messagePact
.expectsToReceive("a request to save an event")
.withContent({
id: like(1),
event: like("something important"),
type: term({ generate: "save", matcher: "^(save|update|cancel)$" }),
})
.withMetadata({
"content-type": "application/json",
describe("Message consumer tests", () => {
const messagePact = new MessageConsumerPact({
consumer: "MyJSMessageConsumer",
dir: path.resolve(process.cwd(), "pacts"),
pactfileWriteMode: "update",
provider: "MyJSMessageProvider",
logLevel: "info",
})
describe("receive dog event", () => {
it("accepts a valid dog", () => {
return messagePact
.given("some state")
.expectsToReceive("a request for a dog")
.withContent({
id: like(1),
name: like("rover"),
type: term({ generate: "bulldog", matcher: "^(bulldog|sheepdog)$" }),