Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict'
const pact = require('@pact-foundation/pact-node')
const path = require('path')
require('./testSitesService')
const opts = {
providerBaseUrl: 'http://localhost:3001',
providerStatesSetupUrl: 'http://localhost:3001/test/setup',
pactUrls: [path.resolve(__dirname, '../../pacts/client-siteservice.json')]
}
pact.verifyPacts(opts).then(() => {
console.log('success')
process.exit(0)
}).catch((error) => {
console.log('failed', error)
process.exit(1)
})
var pact = require('@pact-foundation/pact-node');
var path = require('path');
const PostService = require('../PostService');
var opts = {
providerBaseUrl: 'http://localhost:8081',
providerStatesUrl: 'http://localhost:8081/states',
providerStatesSetupUrl: 'http://localhost:8081/setup',
pactUrls: [path.resolve(__dirname, '../../../pacts/my_consumer-posts_provider.json')]
};
pact.verifyPacts(opts).then(() => {
console.log('success');
process.exit(0);
}).catch((error) => {
console.log('failed', error);
process.exit(1);
});
return (server: http.Server) => {
const opts = {
...omit(this.config, "handlers"),
...{ providerBaseUrl: "http://localhost:" + server.address().port },
} as VerifierOptions
return qToPromise(serviceFactory.verifyPacts(opts))
}
}
return (server: http.Server) => {
const opts = {
providerStatesSetupUrl: `${this.address}:${server.address().port}${
this.stateSetupPath
}`,
...omit(this.config, "handlers"),
providerBaseUrl: `${this.address}:${server.address().port}`,
}
return qToPromise(pact.verifyPacts(opts))
}
}
var test = new Test('should honour interactions', function (done) {
wrapper.verifyPacts(opts)
.then(function (data) {
fn(data, done)
})
.catch(function (err) {
done(err)
})
})
const toValidate = validUrl.isUri(args.PACT_FILE) ? args.PACT_FILE : path.resolve(process.cwd(), args.PACT_FILE);
const opts = {
pactUrls: [toValidate],
providerBaseUrl: args.provider_base_url,
providerStatesSetupUrl: args.states_setup_url,
};
if (config.brokerUser.trim() !== '') {
Object.assign(opts, {
pactBrokerUsername: config.brokerUser,
pactBrokerPassword: config.brokerPassword,
});
}
pact.verifyPacts(opts).then((pactObject) => {
log('=================================================================================');
log(`Pact ${args.PACT_FILE} verified with following result`);
log('=================================================================================');
log(JSON.stringify(pactObject, null, 2));
log('=================================================================================');
}, (err) => log(`Verify failed because of \n${err}`));
}