mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
Fix vue test stacktraces (#12612)
* Issue 10786 - Add unit test for Home component * Issue 10786 - Improve test setup and test invite parameter variations * Issue 10786 - Improve Vue.js test isolation by adding async keyword to dispatch function * Issue 10786 - Missing action does not need to be awaited * fix(vuejs-unit-tests): Fewer stacktraces in avatar.spec.js * No more stacktraces in avatar.spec.js * Register dummy directive in chatCard.spec.js * Resolve stacktraces in column.spec.js * Resolve stacktrace in notifications.spec.js * Resolve warnings in user.spec.js * Resolve asynchronous stacktrace from home.spec.js * Remove unnecessary mount call. * Clear up some let clutter in column.spec.js
This commit is contained in:
@@ -6,6 +6,19 @@ const localVue = createLocalVue();
|
||||
localVue.use(Store);
|
||||
|
||||
describe('Tasks User', () => {
|
||||
function createWrapper (challengeTag) {
|
||||
const store = new Store({
|
||||
state: { user: { data: { tags: [challengeTag] } } },
|
||||
getters: {},
|
||||
});
|
||||
return shallowMount(User, {
|
||||
store,
|
||||
localVue,
|
||||
mocks: { $t: s => s },
|
||||
stubs: ['b-tooltip'],
|
||||
});
|
||||
}
|
||||
|
||||
describe('Computed Properties', () => {
|
||||
it('should render a challenge tag under challenge header in tag filter popup when the challenge is active', () => {
|
||||
const activeChallengeTag = {
|
||||
@@ -13,20 +26,7 @@ describe('Tasks User', () => {
|
||||
name: 'Challenge1',
|
||||
challenge: true,
|
||||
};
|
||||
const state = {
|
||||
user: {
|
||||
data: {
|
||||
tags: [activeChallengeTag],
|
||||
},
|
||||
},
|
||||
};
|
||||
const getters = {};
|
||||
const store = new Store({ state, getters });
|
||||
const wrapper = shallowMount(User, {
|
||||
store,
|
||||
localVue,
|
||||
});
|
||||
|
||||
const wrapper = createWrapper(activeChallengeTag);
|
||||
const computedTagsByType = wrapper.vm.tagsByType;
|
||||
|
||||
expect(computedTagsByType.challenges.tags.length).to.equal(1);
|
||||
@@ -40,20 +40,7 @@ describe('Tasks User', () => {
|
||||
name: 'Challenge1',
|
||||
challenge: false,
|
||||
};
|
||||
const state = {
|
||||
user: {
|
||||
data: {
|
||||
tags: [inactiveChallengeTag],
|
||||
},
|
||||
},
|
||||
};
|
||||
const getters = {};
|
||||
const store = new Store({ state, getters });
|
||||
const wrapper = shallowMount(User, {
|
||||
store,
|
||||
localVue,
|
||||
});
|
||||
|
||||
const wrapper = createWrapper(inactiveChallengeTag);
|
||||
const computedTagsByType = wrapper.vm.tagsByType;
|
||||
|
||||
expect(computedTagsByType.challenges.tags.length).to.equal(0);
|
||||
|
||||
Reference in New Issue
Block a user