Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe('Taxonomy Service pact with Search App', () => {
- const provider = pact({
- consumer: 'flex-search-app',
- provider: SERVICE_NAME,
- port: 18149,
- log: path.join(process.cwd(), '../', 'pact', 'logs', `${SERVICE_NAME}.log`),
- dir: path.join(process.cwd(), '../', 'pact', SERVICE_NAME),
- logLevel: 'INFO',
- spec: 2
- });
- before(() => {
- return provider.setup();
- });
- describe('Listing taxonomies', () => {
- before(() => {
- return provider.addInteraction({
- given: 'GET call for taxonomies',
- uponReceiving: 'Get object for listing taxonomies',
- withRequest: {
- method: 'GET',
- path: '/api/taxonomies',
- query: {
- accountId: term({
- generate: '4',
- matcher: '4'
- }),
- enabled: term({
- generate: 'true',
- matcher: 'true'
- })
- }
- },
- willRespondWith: {
- status: 200,
- body: [
- like ({
- 'id': like(8061159),
- 'name': like('Country'),
- 'displayName': like('Country'),
- 'description': like(''),
- 'enabled': like(true),
- 'accountId': like(4),
- 'visibilityIds': like([
- 4,
- 10329,
- 10323,
- 10240,
- 17575
- ]),
- 'userId': like(5),
- 'created': like('31 Jan 2018 11:56:48 +00:00'),
- 'lastModified': like('01 Feb 2018 11:58:49 +00:00')
- })
- ]
- }
- });
- });
- it('should generate a list of taxonomies', () => {
- return request.get(`http://localhost:${PORT}/api/taxonomies?accountId=4&enabled=true`)
- .set({ 'Accept': 'application/json' }).then((response) => {
- return expect(Promise.resolve(response.status)).to.eventually.equals(200);
- }).catch(err => {
- console.log("Error in taxonomy listing", err);
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement