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
53
54
55
56
57
58
59
|
import mutations from '~/whats_new/store/mutations';
import createState from '~/whats_new/store/state';
import * as types from '~/whats_new/store/mutation_types';
describe('whats new mutations', () => {
let state;
beforeEach(() => {
state = createState;
});
describe('openDrawer', () => {
it('sets open to true', () => {
mutations[types.OPEN_DRAWER](state);
expect(state.open).toBe(true);
});
});
describe('closeDrawer', () => {
it('sets open to false', () => {
mutations[types.CLOSE_DRAWER](state);
expect(state.open).toBe(false);
});
});
describe('addFeatures', () => {
it('adds features from data', () => {
mutations[types.ADD_FEATURES](state, ['bells and whistles']);
expect(state.features).toEqual(['bells and whistles']);
});
it('when there are already items, it adds items', () => {
state.features = ['shiny things'];
mutations[types.ADD_FEATURES](state, ['bells and whistles']);
expect(state.features).toEqual(['shiny things', 'bells and whistles']);
});
});
describe('setPageInfo', () => {
it('sets page info', () => {
mutations[types.SET_PAGE_INFO](state, { nextPage: 8 });
expect(state.pageInfo).toEqual({ nextPage: 8 });
});
});
describe('setFetching', () => {
it('sets fetching', () => {
mutations[types.SET_FETCHING](state, true);
expect(state.fetching).toBe(true);
});
});
describe('setDrawerBodyHeight', () => {
it('sets drawerBodyHeight', () => {
mutations[types.SET_DRAWER_BODY_HEIGHT](state, 840);
expect(state.drawerBodyHeight).toBe(840);
});
});
});
|