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:
Bart Enkelaar
2020-10-01 19:08:34 +02:00
committed by GitHub
parent 73c5764d63
commit 32ac00b417
7 changed files with 191 additions and 107 deletions
@@ -1,4 +1,4 @@
import { mount, createLocalVue } from '@vue/test-utils';
import { shallowMount, createLocalVue } from '@vue/test-utils';
import TaskColumn from '@/components/tasks/column.vue';
import Store from '@/libs/store';
@@ -7,10 +7,6 @@ localVue.use(Store);
describe('Task Column', () => {
let wrapper;
let store; let
getters;
let habits; let taskListOverride; let
tasks;
function makeWrapper (additionalSetup = {}) {
const type = 'habit';
@@ -19,9 +15,12 @@ describe('Task Column', () => {
};
const stubs = ['b-modal']; // <b-modal> is a custom component and not tested here
return mount(TaskColumn, {
propsData: {
type,
return shallowMount(TaskColumn, {
propsData: { type },
store: {
getters: {
'tasks:getFilteredTaskList': () => [],
},
},
mocks,
stubs,
@@ -56,6 +55,9 @@ describe('Task Column', () => {
});
describe('Computed Properties', () => {
let taskListOverride;
let habits;
beforeEach(() => {
habits = [
{ id: 1 },
@@ -67,14 +69,14 @@ describe('Task Column', () => {
{ id: 4 },
];
getters = {
const getters = {
// (...) => { ... } will return a value
// (...) => (...) => { ... } will return a function
// Task Column expects a function
'tasks:getFilteredTaskList': () => () => habits,
};
store = new Store({ getters });
const store = new Store({ getters });
wrapper = makeWrapper({ store });
});
@@ -103,6 +105,8 @@ describe('Task Column', () => {
});
describe('Methods', () => {
let tasks;
describe('Filter By Tags', () => {
beforeEach(() => {
tasks = [