How to use the @pact-foundation/pact.MessageProviderPact function in @pact-foundation/pact

To help you get started, we’ve selected a few @pact-foundation/pact examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pact-foundation / pact-js / examples / messages / provider / message-provider.spec.ts View on Github external
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",
github thombergs / code-examples / pact / pact-node-messages / src / provider / hero-event-producer.spec.js View on Github external
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',
github pact-foundation / pact-js / examples / serverless / provider / message-provider.spec.js View on Github external
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,