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

edit.spec.js « pipeline_schedule « project « specs « consumer « contracts « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 117e6754255e36ad667a602e0dd3d04202261adf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { pactWith } from 'jest-pact';

import { UpdatePipelineSchedule } from '../../../fixtures/project/pipeline_schedule/update_pipeline_schedule.fixture';
import { updatePipelineSchedule } from '../../../resources/api/pipeline_schedules';

const CONSUMER_NAME = 'PipelineSchedules#edit';
const CONSUMER_LOG = '../logs/consumer.log';
const CONTRACT_DIR = '../contracts/project/pipeline_schedule/edit';
const PROVIDER_NAME = 'PUT Edit a pipeline schedule';

// API endpoint: /pipelines.json
pactWith(
  {
    consumer: CONSUMER_NAME,
    provider: PROVIDER_NAME,
    log: CONSUMER_LOG,
    dir: CONTRACT_DIR,
  },

  (provider) => {
    describe(PROVIDER_NAME, () => {
      beforeEach(() => {
        const interaction = {
          ...UpdatePipelineSchedule.scenario,
          ...UpdatePipelineSchedule.request,
          willRespondWith: UpdatePipelineSchedule.success,
        };

        provider.addInteraction(interaction);
      });

      it('returns a successful body', async () => {
        const pipelineSchedule = await updatePipelineSchedule({
          url: provider.mockService.baseUrl,
        });

        expect(pipelineSchedule.status).toEqual(UpdatePipelineSchedule.success.status);
      });
    });
  },
);