debian-mirror-gitlab/qa/contracts/consumer/specs/diffs.spec.js
2022-05-07 20:08:51 +05:30

35 lines
821 B
JavaScript

'use strict';
const { pactWith } = require('jest-pact');
const { Diffs } = require('../fixtures/diffs.fixture');
const { getDiffs } = require('../endpoints/merge_request');
pactWith(
{
consumer: 'Merge Request Page',
provider: 'Merge Request Diffs Endpoint',
log: '../logs/consumer.log',
dir: '../contracts',
},
(provider) => {
describe('Diffs Endpoint', () => {
beforeEach(() => {
const interaction = {
...Diffs.request,
willRespondWith: Diffs.success,
};
return provider.addInteraction(interaction);
});
it('return a successful body', () => {
return getDiffs({
url: provider.mockService.baseUrl,
}).then((diffs) => {
expect(diffs).toEqual(Diffs.body);
});
});
});
},
);