jeudi 24 août 2017

When using JS Pact in the browser, how do I create the pact files?

I am using the JS pact library ( http://ift.tt/2wHlmdp) to test a polymer application. I need to test the ajax code in the application, and I want to test it in the browser.

I now have all of that working in my github repo http://ift.tt/2vhONQ0 (I do need to manually lift and tear down the pact broker at the moment)

I want now to produce the pact files. And... that makes it interesting because the tests are running in the browser. The normal approach to this appears to be to pass information to the Pact(), as per //github.com/pact-foundation/pact-node#create-pact-mock-server

 provider = Pact({
            consumer: 'Friends Client',
            provider: 'Friends API',
            host: "localhost",
            port: 9999,
          // HERE I WOULD SPECIFY THE LOCATION OF THE PACT FILES
            spec: '3.0.0' // http://ift.tt/1qOuCGV
        });

However this code is running on the browser. The browser doesn't let me have access to files!

How should I create my pact files?

Thanks!

Aucun commentaire:

Enregistrer un commentaire