blob: 94a0a7d14ee92a67223d1ff830b2ac72318cb7bf (
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
45
46
47
48
49
|
import { shallowMount } from '@vue/test-utils';
import BranchSwitcher from '~/pipeline_editor/components/file_nav/branch_switcher.vue';
import PipelineEditorFileNav from '~/pipeline_editor/components/file_nav/pipeline_editor_file_nav.vue';
describe('Pipeline editor file nav', () => {
let wrapper;
const mockProvide = {
glFeatures: {
pipelineEditorBranchSwitcher: true,
},
};
const createComponent = ({ provide = {} } = {}) => {
wrapper = shallowMount(PipelineEditorFileNav, {
provide: {
...mockProvide,
...provide,
},
});
};
const findBranchSwitcher = () => wrapper.findComponent(BranchSwitcher);
afterEach(() => {
wrapper.destroy();
});
describe('template', () => {
beforeEach(() => {
createComponent();
});
it('renders the branch switcher', () => {
expect(findBranchSwitcher().exists()).toBe(true);
});
});
describe('with branch switcher feature flag OFF', () => {
it('does not render the branch switcher', () => {
createComponent({
provide: {
glFeatures: { pipelineEditorBranchSwitcher: false },
},
});
expect(findBranchSwitcher().exists()).toBe(false);
});
});
});
|