Skip to content

Commit

Permalink
Merge pull request #9 from pact-foundation/fix/readme-example
Browse files Browse the repository at this point in the history
fix(readme): fix example in readme
  • Loading branch information
tarciosaraiva authored Aug 9, 2016
2 parents ea10a8d + f0eeb0f commit 05bd5bd
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,14 @@ More questions about what's involved in Pact? [Read more about it](http://docs.p
Check the `examples` folder for examples with Karma Jasmine / Mocha. The example below is taken from the [integration spec](https://github.com/pact-foundation/pact-js/blob/master/test/dsl/integration.spec.js).

```javascript
import path from 'path'
import { expect } from 'chai'
import Promise from 'bluebird'
import request from 'superagent'
import wrapper from '@pact-foundation/pact-node'

import { default as Pact } from 'pact'

// great library to spin up the Pact Verifier Server
// that will record interactions and eventually validate your pacts
import wrapper from '@pact-foundation/pact-node'
var path = require('path')
var chai = require("chai")
var expect = chai.expect
var chaiAsPromised = require("chai-as-promised")
var request = require ('superagent')
var wrapper = require('@pact-foundation/pact-node')
var Pact = require('pact')
chai.use(chaiAsPromised);

describe('Pact', () => {

Expand Down Expand Up @@ -129,15 +126,15 @@ describe('Pact', () => {
})

context('with a single request', () => {
it('successfully writes Pact file', (done) => {
describe('successfully writes Pact file', () => {

// add interactions, as many as needed
beforeEach((done) => {
provider.addInteraction({
state: 'i have a list of projects',
uponReceiving: 'a request for projects',
withRequest: {
method: 'get',
method: 'GET',
path: '/projects',
headers: { 'Accept': 'application/json' }
},
Expand All @@ -162,7 +159,6 @@ describe('Pact', () => {
.get('http://localhost:1234/projects')
.set({ 'Accept': 'application/json' })
.then(provider.verify)

expect(verificationPromise).to.eventually.eql(JSON.stringify(EXPECTED_BODY)).notify(done)
})
})
Expand Down

0 comments on commit 05bd5bd

Please sign in to comment.