blob: 1f65884e95950a04fc015fadd57f39aae482425d (
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
50
51
52
|
import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex';
import ConfidentialityFilter from '~/search/sidebar/components/confidentiality_filter.vue';
import RadioFilter from '~/search/sidebar/components/radio_filter.vue';
Vue.use(Vuex);
describe('ConfidentialityFilter', () => {
let wrapper;
const createComponent = (state) => {
const store = new Vuex.Store({
state,
});
wrapper = shallowMount(ConfidentialityFilter, {
store,
});
};
const findRadioFilter = () => wrapper.findComponent(RadioFilter);
const findHR = () => wrapper.findComponent('hr');
describe('old sidebar', () => {
beforeEach(() => {
createComponent({ useNewNavigation: false });
});
it('renders the component', () => {
expect(findRadioFilter().exists()).toBe(true);
});
it('renders the divider', () => {
expect(findHR().exists()).toBe(true);
});
});
describe('new sidebar', () => {
beforeEach(() => {
createComponent({ useNewNavigation: true });
});
it('renders the component', () => {
expect(findRadioFilter().exists()).toBe(true);
});
it("doesn't render the divider", () => {
expect(findHR().exists()).toBe(false);
});
});
});
|