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
50
|
import { shallowMount } from '@vue/test-utils';
import CompareApp from '~/merge_requests/components/compare_app.vue';
let wrapper;
function factory(provideData = {}) {
wrapper = shallowMount(CompareApp, {
provide: {
inputs: {
project: {
id: 'project',
name: 'project',
},
branch: {
id: 'branch',
name: 'branch',
},
},
toggleClass: {
project: 'project',
branch: 'branch',
},
i18n: {
projectHeaderText: 'Project',
branchHeaderText: 'Branch',
},
...provideData,
},
});
}
describe('Merge requests compare app component', () => {
afterEach(() => {
wrapper.destroy();
});
it('shows commit box when selected branch is empty', () => {
factory({
currentBranch: {
text: '',
value: '',
},
});
const commitBox = wrapper.find('[data-testid="commit-box"]');
expect(commitBox.exists()).toBe(true);
expect(commitBox.text()).toBe('Select a branch to compare');
});
});
|