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
|
import * as comingSoon from '~/packages/list/coming_soon/helpers';
import { fakeIssues, asGraphQLResponse, asViewModel } from './mock_data';
jest.mock('~/api.js');
describe('Coming Soon Helpers', () => {
const [noLabels, acceptingMergeRequestLabel, workflowLabel] = fakeIssues;
describe('toViewModel', () => {
it('formats a GraphQL response correctly', () => {
expect(comingSoon.toViewModel(asGraphQLResponse)).toEqual(asViewModel);
});
});
describe('findWorkflowLabel', () => {
it('finds a workflow label', () => {
expect(comingSoon.findWorkflowLabel(workflowLabel.labels)).toEqual(workflowLabel.labels[0]);
});
it("returns undefined when there isn't one", () => {
expect(comingSoon.findWorkflowLabel(noLabels.labels)).toBeUndefined();
});
});
describe('findAcceptingContributionsLabel', () => {
it('finds the correct label when it exists', () => {
expect(comingSoon.findAcceptingContributionsLabel(acceptingMergeRequestLabel.labels)).toEqual(
acceptingMergeRequestLabel.labels[0],
);
});
it("returns undefined when there isn't one", () => {
expect(comingSoon.findAcceptingContributionsLabel(noLabels.labels)).toBeUndefined();
});
});
});
|