Skip to content

Commit 936a75d

Browse files
committed
fix(test): update all mainline tests to match new API
1 parent 381bf9d commit 936a75d

File tree

4 files changed

+214
-234
lines changed

4 files changed

+214
-234
lines changed

src/dsl/mockService.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ module.exports = class MockService {
5151
* @returns {Promise}
5252
*/
5353
removeInteractions () {
54+
console.log('removing interactions')
5455
return this._request.send('DELETE', `${this._baseURL}/interactions`)
5556
}
5657

src/pact.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const Interaction = require('./dsl/interaction')
1616
const responseParser = require('./common/responseParser').parse
1717
const serviceFactory = require('@pact-foundation/pact-node')
1818
const clc = require('cli-color')
19+
const path = require('path')
20+
1921
/**
2022
* Creates a new {@link PactProvider}.
2123
* @memberof Pact
@@ -67,9 +69,7 @@ module.exports = (opts) => {
6769
* Start the Mock Server.
6870
* @returns {Promise}
6971
*/
70-
setup: () => {
71-
return server.start()
72-
},
72+
setup: () => server.start(),
7373

7474
/**
7575
* Add an interaction to the {@link MockService}.
@@ -101,9 +101,7 @@ module.exports = (opts) => {
101101
* @returns {Promise}
102102
*/
103103
verify: () => {
104-
console.log('verify()')
105104
return mockService.verify()
106-
// .then(mockService.removeInteractions)
107105
.then(() => { mockService.removeInteractions() })
108106
.catch(e => {
109107
// Properly format the error
@@ -114,16 +112,16 @@ module.exports = (opts) => {
114112
throw new Error('Pact verification failed - expected interactions did not match actual.')
115113
})
116114
},
115+
117116
/**
118117
* Writes the Pact and clears any interactions left behind and shutdown the
119118
* mock server
120119
* @memberof PactProvider
121120
* @instance
122121
* @returns {Promise}
123122
*/
124-
finalize: () => {
125-
return mockService.writePact().then(() => server.delete())
126-
},
123+
finalize: () => mockService.writePact().then(() => server.delete()),
124+
127125
/**
128126
* Writes the pact file out to file. Should be called when all tests have been performed for a
129127
* given Consumer <-> Provider pair. It will write out the Pact to the
@@ -132,18 +130,15 @@ module.exports = (opts) => {
132130
* @instance
133131
* @returns {Promise}
134132
*/
135-
writePact: () => {
136-
return mockService.writePact()
137-
},
133+
writePact: () => mockService.writePact(),
134+
138135
/**
139136
* Clear up any interactions in the Provider Mock Server.
140137
* @memberof PactProvider
141138
* @instance
142139
* @returns {Promise}
143140
*/
144-
removeInteractions: () => {
145-
return mockService.removeInteractions()
146-
}
141+
removeInteractions: () => mockService.removeInteractions()
147142
}
148143
}
149144

0 commit comments

Comments
 (0)