blob: f667ebc0fcbd5c6a802ae17720f578b4552866db (
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
|
import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex';
import DiffFileDrafts from '~/batch_comments/components/diff_file_drafts.vue';
import DraftNote from '~/batch_comments/components/draft_note.vue';
import DesignNotePin from '~/vue_shared/components/design_management/design_note_pin.vue';
Vue.use(Vuex);
describe('Batch comments diff file drafts component', () => {
let vm;
function factory() {
const store = new Vuex.Store({
modules: {
batchComments: {
namespaced: true,
getters: {
draftsForFile: () => () => [{ id: 1 }, { id: 2 }],
},
},
},
});
vm = shallowMount(DiffFileDrafts, {
store,
propsData: { fileHash: 'filehash' },
});
}
it('renders list of draft notes', () => {
factory();
expect(vm.findAllComponents(DraftNote).length).toEqual(2);
});
it('renders index of draft note', () => {
factory();
const elements = vm.findAllComponents(DesignNotePin);
expect(elements.length).toEqual(2);
expect(elements.at(0).props('label')).toEqual(1);
expect(elements.at(1).props('label')).toEqual(2);
});
});
|