summaryrefslogtreecommitdiff
path: root/spec/contracts/consumer/specs/project/pipeline/show.spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/contracts/consumer/specs/project/pipeline/show.spec.js')
-rw-r--r--spec/contracts/consumer/specs/project/pipeline/show.spec.js54
1 files changed, 45 insertions, 9 deletions
diff --git a/spec/contracts/consumer/specs/project/pipeline/show.spec.js b/spec/contracts/consumer/specs/project/pipeline/show.spec.js
index 0f1cc1c3108..be6abb78eb5 100644
--- a/spec/contracts/consumer/specs/project/pipeline/show.spec.js
+++ b/spec/contracts/consumer/specs/project/pipeline/show.spec.js
@@ -1,36 +1,37 @@
-/* eslint-disable @gitlab/require-i18n-strings */
-
import { pactWith } from 'jest-pact';
import { GraphQLInteraction } from '@pact-foundation/pact';
import { extractGraphQLQuery } from '../../../helpers/graphql_query_extractor';
import { PipelineHeaderData } from '../../../fixtures/project/pipeline/get_pipeline_header_data.fixture';
-import { getPipelineHeaderDataRequest } from '../../../resources/graphql/pipelines';
+import { DeletePipeline } from '../../../fixtures/project/pipeline/delete_pipeline.fixture';
+
+import { getPipelineHeaderDataRequest, deletePipeline } from '../../../resources/graphql/pipelines';
const CONSUMER_NAME = 'Pipelines#show';
const CONSUMER_LOG = '../logs/consumer.log';
const CONTRACT_DIR = '../contracts/project/pipeline/show';
-const PROVIDER_NAME = 'GET pipeline header data';
+const GET_PIPELINE_HEADER_DATA_PROVIDER_NAME = 'GET pipeline header data';
+const DELETE_PIPELINE_PROVIDER_NAME = 'DELETE pipeline';
// GraphQL query: getPipelineHeaderData
pactWith(
{
consumer: CONSUMER_NAME,
- provider: PROVIDER_NAME,
+ provider: GET_PIPELINE_HEADER_DATA_PROVIDER_NAME,
log: CONSUMER_LOG,
dir: CONTRACT_DIR,
},
(provider) => {
- describe(PROVIDER_NAME, () => {
+ describe(GET_PIPELINE_HEADER_DATA_PROVIDER_NAME, () => {
beforeEach(async () => {
const query = await extractGraphQLQuery(
'app/assets/javascripts/pipelines/graphql/queries/get_pipeline_header_data.query.graphql',
);
const graphqlQuery = new GraphQLInteraction()
- .given('a pipeline for a project exists')
- .uponReceiving('a request for the pipeline header data')
+ .given(PipelineHeaderData.scenario.state)
+ .uponReceiving(PipelineHeaderData.scenario.uponReceiving)
.withQuery(query)
.withRequest(PipelineHeaderData.request)
.withVariables(PipelineHeaderData.variables)
@@ -50,4 +51,39 @@ pactWith(
},
);
-/* eslint-enable @gitlab/require-i18n-strings */
+// GraphQL query: deletePipeline
+pactWith(
+ {
+ consumer: CONSUMER_NAME,
+ provider: DELETE_PIPELINE_PROVIDER_NAME,
+ log: CONSUMER_LOG,
+ dir: CONTRACT_DIR,
+ },
+
+ (provider) => {
+ describe(DELETE_PIPELINE_PROVIDER_NAME, () => {
+ beforeEach(async () => {
+ const query = await extractGraphQLQuery(
+ 'app/assets/javascripts/pipelines/graphql/mutations/delete_pipeline.mutation.graphql',
+ );
+ const graphqlQuery = new GraphQLInteraction()
+ .given(DeletePipeline.scenario.state)
+ .uponReceiving(DeletePipeline.scenario.uponReceiving)
+ .withQuery(query)
+ .withRequest(DeletePipeline.request)
+ .withVariables(DeletePipeline.variables)
+ .willRespondWith(DeletePipeline.success);
+
+ provider.addInteraction(graphqlQuery);
+ });
+
+ it('returns a successful body', async () => {
+ const deletePipelineResponse = await deletePipeline({
+ url: provider.mockService.baseUrl,
+ });
+
+ expect(deletePipelineResponse.status).toEqual(DeletePipeline.success.status);
+ });
+ });
+ },
+);