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

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

42 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-08-27 11:52:29 +05:30
import { pactWith } from 'jest-pact';
2023-03-04 22:38:38 +05:30
import { NewProjectPipeline } from '../../../fixtures/project/pipelines/create_a_new_pipeline.fixture';
2022-08-27 11:52:29 +05:30
import { postProjectPipelines } from '../../../resources/api/project/pipelines';
const CONSUMER_NAME = 'Pipelines#new';
const CONSUMER_LOG = '../logs/consumer.log';
2023-03-04 22:38:38 +05:30
const CONTRACT_DIR = '../contracts/project/pipelines/new';
const PROVIDER_NAME = 'POST create a new pipeline';
2022-08-27 11:52:29 +05:30
// API endpoint: /pipelines.json
pactWith(
{
consumer: CONSUMER_NAME,
provider: PROVIDER_NAME,
log: CONSUMER_LOG,
dir: CONTRACT_DIR,
},
(provider) => {
describe(PROVIDER_NAME, () => {
beforeEach(async () => {
const interaction = {
...NewProjectPipeline.scenario,
...NewProjectPipeline.request,
willRespondWith: NewProjectPipeline.success,
};
provider.addInteraction(interaction);
});
it('returns a successful body', async () => {
const newPipeline = await postProjectPipelines({
url: provider.mockService.baseUrl,
});
expect(newPipeline.status).toEqual(NewProjectPipeline.success.status);
});
});
},
);