diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
commit | b39512ed755239198a9c294b6a45e65c05900235 (patch) | |
tree | d234a3efade1de67c46b9e5a38ce813627726aa7 /spec/contracts/consumer/specs/project/pipeline/new.spec.js | |
parent | d31474cf3b17ece37939d20082b07f6657cc79a9 (diff) |
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'spec/contracts/consumer/specs/project/pipeline/new.spec.js')
-rw-r--r-- | spec/contracts/consumer/specs/project/pipeline/new.spec.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/contracts/consumer/specs/project/pipeline/new.spec.js b/spec/contracts/consumer/specs/project/pipeline/new.spec.js new file mode 100644 index 00000000000..c3824d5979e --- /dev/null +++ b/spec/contracts/consumer/specs/project/pipeline/new.spec.js @@ -0,0 +1,41 @@ +import { pactWith } from 'jest-pact'; + +import { NewProjectPipeline } from '../../../fixtures/project/pipeline/create_a_new_pipeline.fixture'; +import { postProjectPipelines } from '../../../resources/api/project/pipelines'; + +const CONSUMER_NAME = 'Pipelines#new'; +const CONSUMER_LOG = '../logs/consumer.log'; +const CONTRACT_DIR = '../contracts/project/pipeline/new'; +const PROVIDER_NAME = 'POST Create a new pipeline'; + +// 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); + }); + }); + }, +); |