blob: c3824d5979ed96b4efa0969daeb604401dd2a229 (
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 { 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);
});
});
},
);
|