Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/contracts/consumer/specs/project/pipelines/index.spec.js')
-rw-r--r--spec/contracts/consumer/specs/project/pipelines/index.spec.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/contracts/consumer/specs/project/pipelines/index.spec.js b/spec/contracts/consumer/specs/project/pipelines/index.spec.js
new file mode 100644
index 00000000000..14bad31a763
--- /dev/null
+++ b/spec/contracts/consumer/specs/project/pipelines/index.spec.js
@@ -0,0 +1,40 @@
+import { pactWith } from 'jest-pact';
+
+import { ProjectPipelines } from '../../../fixtures/project/pipelines/get_list_project_pipelines.fixture';
+import { getProjectPipelines } from '../../../resources/api/project/pipelines';
+
+const CONSUMER_NAME = 'Pipelines#index';
+const CONSUMER_LOG = '../logs/consumer.log';
+const CONTRACT_DIR = '../contracts/project/pipelines/index';
+const PROVIDER_NAME = 'GET list project pipelines';
+
+// API endpoint: /pipelines.json
+pactWith(
+ {
+ consumer: CONSUMER_NAME,
+ provider: PROVIDER_NAME,
+ log: CONSUMER_LOG,
+ dir: CONTRACT_DIR,
+ },
+
+ (provider) => {
+ describe(PROVIDER_NAME, () => {
+ beforeEach(() => {
+ const interaction = {
+ ...ProjectPipelines.scenario,
+ ...ProjectPipelines.request,
+ willRespondWith: ProjectPipelines.success,
+ };
+ provider.addInteraction(interaction);
+ });
+
+ it('returns a successful body', async () => {
+ const pipelines = await getProjectPipelines({
+ url: provider.mockService.baseUrl,
+ });
+
+ expect(pipelines).toEqual(ProjectPipelines.body);
+ });
+ });
+ },
+);