blob: 1c0358a3e28cbfbd7b4ecd6bb1f2ba600eadbe8b (
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
42
43
44
|
/* eslint-disable @gitlab/require-i18n-strings */
import { pactWith } from 'jest-pact';
import { ProjectPipelines } from '../../../fixtures/project/pipeline/get_list_project_pipelines.fixture';
import { getProjectPipelines } from '../../../endpoints/project/pipelines';
const CONSUMER_NAME = 'Pipelines#index';
const CONSUMER_LOG = '../logs/consumer.log';
const CONTRACT_DIR = '../contracts/project/pipeline/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 = {
state: 'a few pipelines for a project exists',
...ProjectPipelines.request,
willRespondWith: ProjectPipelines.success,
};
provider.addInteraction(interaction);
});
it('returns a successful body', () => {
return getProjectPipelines({
url: provider.mockService.baseUrl,
}).then((pipelines) => {
expect(pipelines).toEqual(ProjectPipelines.body);
});
});
});
},
);
/* eslint-enable @gitlab/require-i18n-strings */
|