2018-08-26 22:41:55 +00:00
|
|
|
import { shallowMount, createLocalVue } from '@vue/test-utils';
|
|
|
|
|
import NotificationsComponent from 'client/components/notifications.vue';
|
|
|
|
|
import Store from 'client/libs/store';
|
2018-09-01 14:37:47 +00:00
|
|
|
import { hasClass } from 'client/store/getters/members';
|
2018-08-26 22:41:55 +00:00
|
|
|
|
|
|
|
|
const localVue = createLocalVue();
|
|
|
|
|
localVue.use(Store);
|
|
|
|
|
|
2018-09-01 14:37:47 +00:00
|
|
|
describe.only('Notifications', () => {
|
2018-08-26 22:41:55 +00:00
|
|
|
let store;
|
|
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
|
store = new Store({
|
|
|
|
|
state: {
|
|
|
|
|
user: {
|
|
|
|
|
data: {
|
|
|
|
|
stats: {
|
|
|
|
|
lvl: 0,
|
|
|
|
|
},
|
|
|
|
|
flags: {},
|
|
|
|
|
preferences: {},
|
|
|
|
|
party: {
|
|
|
|
|
quest: {
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
actions: {
|
|
|
|
|
'user:fetch': () => {},
|
|
|
|
|
'tasks:fetchUserTasks': () => {},
|
|
|
|
|
},
|
2018-09-01 14:37:47 +00:00
|
|
|
getters: {
|
|
|
|
|
'members:hasClass': hasClass,
|
|
|
|
|
},
|
2018-08-26 22:41:55 +00:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('set user has class computed prop', () => {
|
|
|
|
|
const wrapper = shallowMount(NotificationsComponent, { store, localVue });
|
|
|
|
|
|
|
|
|
|
expect(wrapper.vm.userHasClass).to.be.false;
|
|
|
|
|
|
|
|
|
|
store.state.user.data.stats.lvl = 10;
|
|
|
|
|
store.state.user.data.flags.classSelected = true;
|
|
|
|
|
store.state.user.data.preferences.disableClasses = false;
|
|
|
|
|
|
|
|
|
|
expect(wrapper.vm.userHasClass).to.be.true;
|
|
|
|
|
});
|
|
|
|
|
});
|