forked from pact-foundation/pact-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
provider.spec.js
39 lines (34 loc) · 1.2 KB
/
provider.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { PactV3, MatchersV3, XmlBuilder } = require('@pact-foundation/pact');
const { Verifier } = require('@pact-foundation/pact');
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
const { server } = require('../provider.js');
const path = require('path');
const LOG_LEVEL = process.env.LOG_LEVEL || 'WARN';
server.listen(8081, () => {
console.log('SOAP API listening on http://localhost:8081');
});
describe('Pact XML Verification', () => {
it('validates the expectations of Matching Service', () => {
const opts = {
provider: 'XML Service',
providerBaseUrl: 'http://localhost:8081',
pactUrls: ['./pacts/TodoApp-TodoServiceV3.json'],
stateHandlers: {
'i have a list of projects': (params) => {},
'i have a project': (params) => {},
},
logLevel: LOG_LEVEL,
afterEach: async () => {
console.log("Starting afterEach");
await new Promise(r => setTimeout(r, 2000));
console.log("Finished afterEach");
}
};
return new Verifier(opts).verifyProvider().then((output) => {
console.log('Pact Verification Complete!');
console.log(output);
});
});
});