debian-mirror-gitlab/spec/contracts/consumer/specs/project/pipelines/index.spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2022-08-13 15:12:31 +05:30
import { pactWith } from 'jest-pact';
2023-03-04 22:38:38 +05:30
import { ProjectPipelines } from '../../../fixtures/project/pipelines/get_list_project_pipelines.fixture';
2022-08-27 11:52:29 +05:30
import { getProjectPipelines } from '../../../resources/api/project/pipelines';
2022-08-13 15:12:31 +05:30
const CONSUMER_NAME = 'Pipelines#index';
const CONSUMER_LOG = '../logs/consumer.log';
2023-03-04 22:38:38 +05:30
const CONTRACT_DIR = '../contracts/project/pipelines/index';
const PROVIDER_NAME = 'GET list project pipelines';
2022-08-13 15:12:31 +05:30
// API endpoint: /pipelines.json
pactWith(
{
consumer: CONSUMER_NAME,
provider: PROVIDER_NAME,
log: CONSUMER_LOG,
dir: CONTRACT_DIR,
},
(provider) => {
describe(PROVIDER_NAME, () => {
beforeEach(() => {
const interaction = {
2022-08-27 11:52:29 +05:30
...ProjectPipelines.scenario,
2022-08-13 15:12:31 +05:30
...ProjectPipelines.request,
willRespondWith: ProjectPipelines.success,
};
provider.addInteraction(interaction);
});
2022-08-27 11:52:29 +05:30
it('returns a successful body', async () => {
const pipelines = await getProjectPipelines({
2022-08-13 15:12:31 +05:30
url: provider.mockService.baseUrl,
});
2022-08-27 11:52:29 +05:30
expect(pipelines).toEqual(ProjectPipelines.body);
2022-08-13 15:12:31 +05:30
});
});
},
);