diff --git a/webapp/components/AvatarMenu/AvatarMenu.spec.js b/webapp/components/AvatarMenu/AvatarMenu.spec.js
index 5495c9ae6..be34c1804 100644
--- a/webapp/components/AvatarMenu/AvatarMenu.spec.js
+++ b/webapp/components/AvatarMenu/AvatarMenu.spec.js
@@ -1,11 +1,13 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import Vuex from 'vuex'
import AvatarMenu from './AvatarMenu.vue'
const localVue = global.localVue
-config.stubs['nuxt-link'] = ''
-config.stubs['router-link'] = ''
+const stubs = {
+ 'nuxt-link': true,
+ 'router-link': true,
+}
describe('AvatarMenu.vue', () => {
let propsData, getters, wrapper, mocks
@@ -34,7 +36,7 @@ describe('AvatarMenu.vue', () => {
const store = new Vuex.Store({
getters,
})
- return mount(AvatarMenu, { propsData, localVue, store, mocks })
+ return mount(AvatarMenu, { propsData, localVue, store, mocks, stubs })
}
describe('mount', () => {
diff --git a/webapp/components/CommentCard/CommentCard.spec.js b/webapp/components/CommentCard/CommentCard.spec.js
index 0ebcb2649..7764afd1e 100644
--- a/webapp/components/CommentCard/CommentCard.spec.js
+++ b/webapp/components/CommentCard/CommentCard.spec.js
@@ -1,13 +1,10 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import CommentCard from './CommentCard.vue'
import Vuex from 'vuex'
const localVue = global.localVue
localVue.directive('scrollTo', jest.fn())
-config.stubs['client-only'] = ''
-config.stubs['nuxt-link'] = ''
-
describe('CommentCard.vue', () => {
let propsData, mocks, stubs, getters, wrapper, Wrapper
@@ -46,6 +43,8 @@ describe('CommentCard.vue', () => {
}
stubs = {
ContentViewer: true,
+ 'client-only': true,
+ 'nuxt-link': true,
}
getters = {
'auth/user': () => {
@@ -56,7 +55,9 @@ describe('CommentCard.vue', () => {
})
describe('mount', () => {
- beforeEach(jest.useFakeTimers)
+ beforeEach(() => {
+ jest.useFakeTimers()
+ })
Wrapper = () => {
const store = new Vuex.Store({
diff --git a/webapp/components/CommentList/CommentList.spec.js b/webapp/components/CommentList/CommentList.spec.js
index 39f76ff12..f4195aa41 100644
--- a/webapp/components/CommentList/CommentList.spec.js
+++ b/webapp/components/CommentList/CommentList.spec.js
@@ -1,4 +1,4 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import CommentList from './CommentList'
import Vuex from 'vuex'
import Vue from 'vue'
@@ -8,10 +8,6 @@ const localVue = global.localVue
localVue.filter('truncate', (string) => string)
localVue.directive('scrollTo', jest.fn())
-config.stubs['v-popover'] = ''
-config.stubs['nuxt-link'] = ''
-config.stubs['client-only'] = ''
-
describe('CommentList.vue', () => {
let mocks, store, wrapper, propsData, stubs
@@ -72,7 +68,10 @@ describe('CommentList.vue', () => {
},
}
stubs = {
- EditorContent: "
",
+ EditorContent: true,
+ 'v-popover': true,
+ 'nuxt-link': true,
+ 'client-only': true,
}
})
@@ -92,7 +91,9 @@ describe('CommentList.vue', () => {
})
describe('scrollToAnchor mixin', () => {
- beforeEach(jest.useFakeTimers)
+ beforeEach(() => {
+ jest.useFakeTimers()
+ })
describe('$route.hash !== `#comments`', () => {
it('skips $scrollTo', () => {
diff --git a/webapp/components/ComponentSlider/ComponentSlider.spec.js b/webapp/components/ComponentSlider/ComponentSlider.spec.js
index 25bf3e7f4..0f1f345e9 100644
--- a/webapp/components/ComponentSlider/ComponentSlider.spec.js
+++ b/webapp/components/ComponentSlider/ComponentSlider.spec.js
@@ -52,7 +52,7 @@ describe('ComponentSlider.vue', () => {
})
it('renders', () => {
- expect(wrapper.is('div')).toBe(true)
+ expect(wrapper.element.tagName).toBe('DIV')
})
it('click on next Button', async () => {
diff --git a/webapp/components/ContentMenu/ContentMenu.spec.js b/webapp/components/ContentMenu/ContentMenu.spec.js
index 37bef14f6..0bd398e41 100644
--- a/webapp/components/ContentMenu/ContentMenu.spec.js
+++ b/webapp/components/ContentMenu/ContentMenu.spec.js
@@ -1,4 +1,4 @@
-import { config, mount, createLocalVue } from '@vue/test-utils'
+import { mount, createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'
import VTooltip from 'v-tooltip'
import Styleguide from '@human-connection/styleguide'
@@ -10,7 +10,11 @@ localVue.use(Styleguide)
localVue.use(VTooltip)
localVue.use(Vuex)
-config.stubs['router-link'] = ''
+const stubs = {
+ 'router-link': {
+ template: '',
+ },
+}
let getters, mutations, mocks, menuToggle, openModalSpy
@@ -36,7 +40,7 @@ describe('ContentMenu.vue', () => {
'auth/isAdmin': () => false,
}
- const openContentMenu = (values = {}) => {
+ const openContentMenu = async (values = {}) => {
const store = new Vuex.Store({ mutations, getters })
const wrapper = mount(ContentMenu, {
propsData: {
@@ -45,16 +49,17 @@ describe('ContentMenu.vue', () => {
mocks,
store,
localVue,
+ stubs,
})
menuToggle = wrapper.find('[data-test="content-menu-button"]')
- menuToggle.trigger('click')
+ await menuToggle.trigger('click')
return wrapper
}
describe('owner of contribution', () => {
let wrapper
- beforeEach(() => {
- wrapper = openContentMenu({
+ beforeEach(async () => {
+ wrapper = await openContentMenu({
isOwner: true,
resourceType: 'contribution',
resource: {
@@ -86,9 +91,9 @@ describe('ContentMenu.vue', () => {
})
describe('admin can', () => {
- it('pin unpinned post', () => {
+ it('pin unpinned post', async () => {
getters['auth/isAdmin'] = () => true
- const wrapper = openContentMenu({
+ const wrapper = await openContentMenu({
isOwner: false,
resourceType: 'contribution',
resource: {
@@ -111,8 +116,8 @@ describe('ContentMenu.vue', () => {
])
})
- it('unpin pinned post', () => {
- const wrapper = openContentMenu({
+ it('unpin pinned post', async () => {
+ const wrapper = await openContentMenu({
isOwner: false,
resourceType: 'contribution',
resource: {
@@ -135,11 +140,11 @@ describe('ContentMenu.vue', () => {
])
})
- it('can delete another user', () => {
+ it('can delete another user', async () => {
getters['auth/user'] = () => {
return { id: 'some-user', slug: 'some-user' }
}
- const wrapper = openContentMenu({
+ const wrapper = await openContentMenu({
resourceType: 'user',
resource: {
id: 'another-user',
@@ -161,8 +166,8 @@ describe('ContentMenu.vue', () => {
])
})
- it('can not delete the own account', () => {
- const wrapper = openContentMenu({
+ it('can not delete the own account', async () => {
+ const wrapper = await openContentMenu({
resourceType: 'user',
resource: {
id: 'some-user',
@@ -179,8 +184,8 @@ describe('ContentMenu.vue', () => {
describe('owner of comment can', () => {
let wrapper
- beforeEach(() => {
- wrapper = openContentMenu({
+ beforeEach(async () => {
+ wrapper = await openContentMenu({
isOwner: true,
resourceType: 'comment',
resource: {
@@ -208,10 +213,10 @@ describe('ContentMenu.vue', () => {
})
describe('reporting', () => {
- it('a post of another user is possible', () => {
+ it('a post of another user is possible', async () => {
getters['auth/isAdmin'] = () => false
getters['auth/isModerator'] = () => false
- const wrapper = openContentMenu({
+ const wrapper = await openContentMenu({
isOwner: false,
resourceType: 'contribution',
resource: {
@@ -227,8 +232,8 @@ describe('ContentMenu.vue', () => {
expect(openModalSpy).toHaveBeenCalledWith('report')
})
- it('a comment of another user is possible', () => {
- const wrapper = openContentMenu({
+ it('a comment of another user is possible', async () => {
+ const wrapper = await openContentMenu({
isOwner: false,
resourceType: 'comment',
resource: {
@@ -244,8 +249,8 @@ describe('ContentMenu.vue', () => {
expect(openModalSpy).toHaveBeenCalledWith('report')
})
- it('another user is possible', () => {
- const wrapper = openContentMenu({
+ it('another user is possible', async () => {
+ const wrapper = await openContentMenu({
isOwner: false,
resourceType: 'user',
resource: {
@@ -261,8 +266,8 @@ describe('ContentMenu.vue', () => {
expect(openModalSpy).toHaveBeenCalledWith('report')
})
- it('another organization is possible', () => {
- const wrapper = openContentMenu({
+ it('another organization is possible', async () => {
+ const wrapper = await openContentMenu({
isOwner: false,
resourceType: 'organization',
resource: {
@@ -280,10 +285,10 @@ describe('ContentMenu.vue', () => {
})
describe('moderator', () => {
- it('can disable posts', () => {
+ it('can disable posts', async () => {
getters['auth/isAdmin'] = () => false
getters['auth/isModerator'] = () => true
- const wrapper = openContentMenu({
+ const wrapper = await openContentMenu({
isOwner: false,
resourceType: 'contribution',
resource: {
@@ -300,8 +305,8 @@ describe('ContentMenu.vue', () => {
expect(openModalSpy).toHaveBeenCalledWith('disable')
})
- it('can disable comments', () => {
- const wrapper = openContentMenu({
+ it('can disable comments', async () => {
+ const wrapper = await openContentMenu({
isOwner: false,
resourceType: 'comment',
resource: {
@@ -318,8 +323,8 @@ describe('ContentMenu.vue', () => {
expect(openModalSpy).toHaveBeenCalledWith('disable')
})
- it('can disable users', () => {
- const wrapper = openContentMenu({
+ it('can disable users', async () => {
+ const wrapper = await openContentMenu({
isOwner: false,
resourceType: 'user',
resource: {
@@ -336,8 +341,8 @@ describe('ContentMenu.vue', () => {
expect(openModalSpy).toHaveBeenCalledWith('disable')
})
- it('can disable organizations', () => {
- const wrapper = openContentMenu({
+ it('can disable organizations', async () => {
+ const wrapper = await openContentMenu({
isOwner: false,
resourceType: 'organization',
resource: {
@@ -354,8 +359,8 @@ describe('ContentMenu.vue', () => {
expect(openModalSpy).toHaveBeenCalledWith('disable')
})
- it('can release posts', () => {
- const wrapper = openContentMenu({
+ it('can release posts', async () => {
+ const wrapper = await openContentMenu({
isOwner: false,
resourceType: 'contribution',
resource: {
@@ -372,8 +377,8 @@ describe('ContentMenu.vue', () => {
expect(openModalSpy).toHaveBeenCalledWith('release')
})
- it('can release comments', () => {
- const wrapper = openContentMenu({
+ it('can release comments', async () => {
+ const wrapper = await openContentMenu({
isOwner: false,
resourceType: 'comment',
resource: {
@@ -390,8 +395,8 @@ describe('ContentMenu.vue', () => {
expect(openModalSpy).toHaveBeenCalledWith('release')
})
- it('can release users', () => {
- const wrapper = openContentMenu({
+ it('can release users', async () => {
+ const wrapper = await openContentMenu({
isOwner: false,
resourceType: 'user',
resource: {
@@ -408,8 +413,8 @@ describe('ContentMenu.vue', () => {
expect(openModalSpy).toHaveBeenCalledWith('release')
})
- it('can release organizations', () => {
- const wrapper = openContentMenu({
+ it('can release organizations', async () => {
+ const wrapper = await openContentMenu({
isOwner: false,
resourceType: 'organization',
resource: {
@@ -428,10 +433,10 @@ describe('ContentMenu.vue', () => {
})
describe('user', () => {
- it('can access settings', () => {
+ it('can access settings', async () => {
getters['auth/isAdmin'] = () => false
getters['auth/isModerator'] = () => false
- const wrapper = openContentMenu({
+ const wrapper = await openContentMenu({
isOwner: true,
resourceType: 'user',
resource: {
@@ -448,8 +453,8 @@ describe('ContentMenu.vue', () => {
).toBe('/settings')
})
- it('can mute other users', () => {
- const wrapper = openContentMenu({
+ it('can mute other users', async () => {
+ const wrapper = await openContentMenu({
isOwner: false,
resourceType: 'user',
resource: {
@@ -472,8 +477,8 @@ describe('ContentMenu.vue', () => {
])
})
- it('can unmute muted users', () => {
- const wrapper = openContentMenu({
+ it('can unmute muted users', async () => {
+ const wrapper = await openContentMenu({
isOwner: false,
resourceType: 'user',
resource: {
diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js
index 1ef1777fe..8ebd7d4de 100644
--- a/webapp/components/ContributionForm/ContributionForm.spec.js
+++ b/webapp/components/ContributionForm/ContributionForm.spec.js
@@ -1,4 +1,4 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import ContributionForm from './ContributionForm.vue'
import Vuex from 'vuex'
@@ -11,9 +11,11 @@ global.MutationObserver = MutationObserver
const localVue = global.localVue
-config.stubs['client-only'] = ''
-config.stubs['nuxt-link'] = ''
-config.stubs['v-popover'] = ''
+const stubs = {
+ 'client-only': true,
+ 'nuxt-link': true,
+ 'v-popover': true,
+}
describe('ContributionForm.vue', () => {
let wrapper, postTitleInput, expectedParams, cancelBtn, mocks, propsData
@@ -88,6 +90,7 @@ describe('ContributionForm.vue', () => {
localVue,
store,
propsData,
+ stubs,
})
}
diff --git a/webapp/components/DeleteData/DeleteData.spec.js b/webapp/components/DeleteData/DeleteData.spec.js
index c540c9832..f34b2fe6f 100644
--- a/webapp/components/DeleteData/DeleteData.spec.js
+++ b/webapp/components/DeleteData/DeleteData.spec.js
@@ -115,9 +115,9 @@ describe('DeleteData.vue', () => {
enableContributionDeletionCheckbox = wrapper.find(
'[data-test="contributions-deletion-checkbox"]',
)
- enableContributionDeletionCheckbox.trigger('click')
+ enableContributionDeletionCheckbox.setChecked(true)
enableCommentDeletionCheckbox = wrapper.find('[data-test="comments-deletion-checkbox"]')
- enableCommentDeletionCheckbox.trigger('click')
+ enableCommentDeletionCheckbox.setChecked(true)
deleteAccountBtn.trigger('click')
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
expect.objectContaining({
@@ -133,7 +133,7 @@ describe('DeleteData.vue', () => {
enableContributionDeletionCheckbox = wrapper.find(
'[data-test="contributions-deletion-checkbox"]',
)
- enableContributionDeletionCheckbox.trigger('click')
+ enableContributionDeletionCheckbox.setChecked(true)
deleteAccountBtn.trigger('click')
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
expect.objectContaining({
@@ -147,7 +147,7 @@ describe('DeleteData.vue', () => {
it("deletes a user's comments if requested", () => {
enableCommentDeletionCheckbox = wrapper.find('[data-test="comments-deletion-checkbox"]')
- enableCommentDeletionCheckbox.trigger('click')
+ enableCommentDeletionCheckbox.setChecked(true)
deleteAccountBtn.trigger('click')
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
expect.objectContaining({
diff --git a/webapp/components/Editor/Editor.spec.js b/webapp/components/Editor/Editor.spec.js
index f51c5782f..98c287ced 100644
--- a/webapp/components/Editor/Editor.spec.js
+++ b/webapp/components/Editor/Editor.spec.js
@@ -35,7 +35,7 @@ describe('Editor.vue', () => {
describe('mount', () => {
it('renders', () => {
- expect(Wrapper().is('div')).toBe(true)
+ expect(Wrapper().element.tagName).toBe('DIV')
})
describe('given a piece of text', () => {
diff --git a/webapp/components/Embed/EmbedComponent.spec.js b/webapp/components/Embed/EmbedComponent.spec.js
index cd3526368..0d20f969f 100644
--- a/webapp/components/Embed/EmbedComponent.spec.js
+++ b/webapp/components/Embed/EmbedComponent.spec.js
@@ -160,7 +160,7 @@ describe('EmbedComponent.vue', () => {
describe('sets permanently', () => {
beforeEach(() => {
- wrapper.find('input[type=checkbox]').trigger('click')
+ wrapper.find('input[type=checkbox]').setChecked(true)
wrapper.find('[data-test="play-now-button"]').trigger('click')
})
diff --git a/webapp/components/EnterNonce/EnterNonce.spec.js b/webapp/components/EnterNonce/EnterNonce.spec.js
index a1f2e6b94..e75c8cf49 100644
--- a/webapp/components/EnterNonce/EnterNonce.spec.js
+++ b/webapp/components/EnterNonce/EnterNonce.spec.js
@@ -19,7 +19,9 @@ describe('EnterNonce ', () => {
})
describe('mount', () => {
- beforeEach(jest.useFakeTimers)
+ beforeEach(() => {
+ jest.useFakeTimers()
+ })
Wrapper = () => {
return mount(EnterNonce, {
diff --git a/webapp/components/Group/GroupForm.spec.js b/webapp/components/Group/GroupForm.spec.js
index 0300bacd0..0eb503856 100644
--- a/webapp/components/Group/GroupForm.spec.js
+++ b/webapp/components/Group/GroupForm.spec.js
@@ -1,9 +1,11 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import GroupForm from './GroupForm.vue'
const localVue = global.localVue
-config.stubs['nuxt-link'] = ''
+const stubs = {
+ 'nuxt-link': true,
+}
const propsData = {
update: false,
@@ -25,7 +27,7 @@ describe('GroupForm', () => {
describe('mount', () => {
const Wrapper = () => {
- return mount(GroupForm, { propsData, mocks, localVue })
+ return mount(GroupForm, { propsData, mocks, localVue, stubs })
}
beforeEach(() => {
diff --git a/webapp/components/Hashtag/Hashtag.spec.js b/webapp/components/Hashtag/Hashtag.spec.js
index 4a420d7d8..873919e20 100644
--- a/webapp/components/Hashtag/Hashtag.spec.js
+++ b/webapp/components/Hashtag/Hashtag.spec.js
@@ -1,10 +1,12 @@
-import { config, shallowMount } from '@vue/test-utils'
+import { shallowMount } from '@vue/test-utils'
import Hashtag from './Hashtag'
const localVue = global.localVue
-config.stubs['nuxt-link'] = ''
+const stubs = {
+ 'nuxt-link': true,
+}
describe('Hashtag', () => {
let id
@@ -15,6 +17,7 @@ describe('Hashtag', () => {
propsData: {
id,
},
+ stubs,
})
}
diff --git a/webapp/components/HashtagsFilter/HashtagsFilter.spec.js b/webapp/components/HashtagsFilter/HashtagsFilter.spec.js
index 3318ed7c0..07496c9fc 100644
--- a/webapp/components/HashtagsFilter/HashtagsFilter.spec.js
+++ b/webapp/components/HashtagsFilter/HashtagsFilter.spec.js
@@ -29,7 +29,7 @@ describe('HashtagsFilter.vue', () => {
it('renders a card', () => {
wrapper = Wrapper()
- expect(wrapper.is('.base-card')).toBe(true)
+ expect(wrapper.classes('base-card')).toBe(true)
})
describe('click clear search button', () => {
diff --git a/webapp/components/InviteButton/InviteButton.spec.js b/webapp/components/InviteButton/InviteButton.spec.js
index f28045612..fde1afd1d 100644
--- a/webapp/components/InviteButton/InviteButton.spec.js
+++ b/webapp/components/InviteButton/InviteButton.spec.js
@@ -1,7 +1,9 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import InviteButton from './InviteButton.vue'
-config.stubs['v-popover'] = ''
+const stubs = {
+ 'v-popover': true,
+}
describe('InviteButton.vue', () => {
let wrapper
@@ -22,7 +24,7 @@ describe('InviteButton.vue', () => {
describe('mount', () => {
const Wrapper = () => {
- return mount(InviteButton, { mocks, propsData })
+ return mount(InviteButton, { mocks, propsData, stubs })
}
beforeEach(() => {
diff --git a/webapp/components/LocaleSwitch/LocaleSwitch.spec.js b/webapp/components/LocaleSwitch/LocaleSwitch.spec.js
index 800309bfc..158624f18 100644
--- a/webapp/components/LocaleSwitch/LocaleSwitch.spec.js
+++ b/webapp/components/LocaleSwitch/LocaleSwitch.spec.js
@@ -1,11 +1,13 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import LocaleSwitch from './LocaleSwitch.vue'
import Vuex from 'vuex'
const localVue = global.localVue
-config.stubs['client-only'] = ''
+const stubs = {
+ 'client-only': true,
+}
describe('LocaleSwitch.vue', () => {
let wrapper, mocks, computed, deutschLanguageItem, getters
@@ -65,7 +67,7 @@ describe('LocaleSwitch.vue', () => {
const store = new Vuex.Store({
getters,
})
- return mount(LocaleSwitch, { mocks, localVue, computed, store })
+ return mount(LocaleSwitch, { mocks, localVue, computed, store, stubs })
}
describe('with current user', () => {
diff --git a/webapp/components/LoginButton/LoginButton.spec.js b/webapp/components/LoginButton/LoginButton.spec.js
index 62e663714..c288b73d3 100644
--- a/webapp/components/LoginButton/LoginButton.spec.js
+++ b/webapp/components/LoginButton/LoginButton.spec.js
@@ -1,7 +1,9 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import LoginButton from './LoginButton.vue'
-config.stubs['v-popover'] = ''
+const stubs = {
+ 'v-popover': true,
+}
describe('LoginButton.vue', () => {
let wrapper
@@ -22,7 +24,7 @@ describe('LoginButton.vue', () => {
describe('mount', () => {
const Wrapper = () => {
- return mount(LoginButton, { mocks, propsData })
+ return mount(LoginButton, { mocks, propsData, stubs })
}
beforeEach(() => {
diff --git a/webapp/components/LoginForm/LoginForm.spec.js b/webapp/components/LoginForm/LoginForm.spec.js
index 10fc2c622..e0972b453 100644
--- a/webapp/components/LoginForm/LoginForm.spec.js
+++ b/webapp/components/LoginForm/LoginForm.spec.js
@@ -2,15 +2,17 @@ import Vue from 'vue'
import LoginForm from './LoginForm.vue'
import Styleguide from '@human-connection/styleguide'
import Vuex from 'vuex'
-import { config, mount, createLocalVue } from '@vue/test-utils'
+import { mount, createLocalVue } from '@vue/test-utils'
const localVue = createLocalVue()
localVue.use(Vuex)
localVue.use(Styleguide)
-config.stubs['nuxt-link'] = ''
-config.stubs['locale-switch'] = ''
-config.stubs['client-only'] = ''
+const stubs = {
+ 'nuxt-link': true,
+ 'locale-switch': true,
+ 'client-only': true,
+}
const authUserMock = jest.fn().mockReturnValue({ activeCategories: [] })
@@ -46,7 +48,7 @@ describe('LoginForm', () => {
error: jest.fn(),
},
}
- return mount(LoginForm, { mocks, localVue, propsData, store })
+ return mount(LoginForm, { mocks, localVue, propsData, store, stubs })
}
describe('fill in email and password and submit', () => {
diff --git a/webapp/components/MasonryGrid/MasonryGridItem.spec.js b/webapp/components/MasonryGrid/MasonryGridItem.spec.js
index 86233efc9..26309f00d 100644
--- a/webapp/components/MasonryGrid/MasonryGridItem.spec.js
+++ b/webapp/components/MasonryGrid/MasonryGridItem.spec.js
@@ -1,9 +1,11 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import MasonryGridItem from './MasonryGridItem'
const localVue = global.localVue
-config.stubs['ds-grid-item'] = ''
+const stubs = {
+ 'ds-grid-item': true,
+}
describe('MasonryGridItem', () => {
let wrapper
@@ -11,34 +13,34 @@ describe('MasonryGridItem', () => {
describe('given an imageAspectRatio', () => {
it('sets the initial rowSpan to 13 when the ratio is higher than 1.3', () => {
const propsData = { imageAspectRatio: 2 }
- wrapper = mount(MasonryGridItem, { localVue, propsData })
+ wrapper = mount(MasonryGridItem, { localVue, propsData, stubs })
expect(wrapper.vm.rowSpan).toBe(13)
})
it('sets the initial rowSpan to 15 when the ratio is between 1.3 and 1', () => {
const propsData = { imageAspectRatio: 1.1 }
- wrapper = mount(MasonryGridItem, { localVue, propsData })
+ wrapper = mount(MasonryGridItem, { localVue, propsData, stubs })
expect(wrapper.vm.rowSpan).toBe(15)
})
it('sets the initial rowSpan to 18 when the ratio is between 1 and 0.7', () => {
const propsData = { imageAspectRatio: 0.7 }
- wrapper = mount(MasonryGridItem, { localVue, propsData })
+ wrapper = mount(MasonryGridItem, { localVue, propsData, stubs })
expect(wrapper.vm.rowSpan).toBe(18)
})
it('sets the initial rowSpan to 25 when the ratio is lower than 0.7', () => {
const propsData = { imageAspectRatio: 0.3 }
- wrapper = mount(MasonryGridItem, { localVue, propsData })
+ wrapper = mount(MasonryGridItem, { localVue, propsData, stubs })
expect(wrapper.vm.rowSpan).toBe(25)
})
describe('given no aspect ratio', () => {
it('sets the initial rowSpan to 8 when not given an imageAspectRatio', () => {
- wrapper = mount(MasonryGridItem, { localVue })
+ wrapper = mount(MasonryGridItem, { localVue, stubs })
expect(wrapper.vm.rowSpan).toBe(8)
})
})
diff --git a/webapp/components/Modal/ConfirmModal.spec.js b/webapp/components/Modal/ConfirmModal.spec.js
index 6d7d0ccf6..28fef3058 100644
--- a/webapp/components/Modal/ConfirmModal.spec.js
+++ b/webapp/components/Modal/ConfirmModal.spec.js
@@ -1,11 +1,13 @@
-import { config, shallowMount, mount } from '@vue/test-utils'
+import { shallowMount, mount } from '@vue/test-utils'
import ConfirmModal from './ConfirmModal.vue'
import { postMenuModalsData } from '~/components/utils/PostHelpers'
const localVue = global.localVue
-config.stubs['sweetalert-icon'] = ''
+const stubs = {
+ 'sweetalert-icon': true,
+}
describe('ConfirmModal.vue', () => {
let Wrapper
@@ -41,6 +43,7 @@ describe('ConfirmModal.vue', () => {
propsData,
mocks,
localVue,
+ stubs,
})
}
@@ -90,10 +93,13 @@ describe('ConfirmModal.vue', () => {
propsData,
mocks,
localVue,
+ stubs,
})
}
- beforeEach(jest.useFakeTimers)
+ beforeEach(() => {
+ jest.useFakeTimers()
+ })
describe('given post id', () => {
beforeEach(() => {
diff --git a/webapp/components/Modal/DeleteUserModal.spec.js b/webapp/components/Modal/DeleteUserModal.spec.js
index d2f28e8b0..1a1c152cd 100644
--- a/webapp/components/Modal/DeleteUserModal.spec.js
+++ b/webapp/components/Modal/DeleteUserModal.spec.js
@@ -1,9 +1,12 @@
-import { config, mount, shallowMount } from '@vue/test-utils'
+import { mount, shallowMount } from '@vue/test-utils'
import Vuex from 'vuex'
import DeleteUserModal from './DeleteUserModal.vue'
const localVue = global.localVue
-config.stubs['sweetalert-icon'] = ''
-config.stubs['nuxt-link'] = ''
+
+const stubs = {
+ 'sweetalert-icon': true,
+ 'nuxt-link': true,
+}
localVue.use(DeleteUserModal)
@@ -49,6 +52,7 @@ describe('DeleteUserModal.vue', () => {
mocks,
store,
localVue,
+ stubs,
})
}
@@ -74,9 +78,12 @@ describe('DeleteUserModal.vue', () => {
mocks,
store,
localVue,
+ stubs,
})
}
- beforeEach(jest.useFakeTimers)
+ beforeEach(() => {
+ jest.useFakeTimers()
+ })
describe('given another user', () => {
beforeEach(() => {
diff --git a/webapp/components/Modal/DisableModal.spec.js b/webapp/components/Modal/DisableModal.spec.js
index b7e52b5a0..0a7ffe25b 100644
--- a/webapp/components/Modal/DisableModal.spec.js
+++ b/webapp/components/Modal/DisableModal.spec.js
@@ -102,7 +102,9 @@ describe('DisableModal.vue', () => {
localVue,
})
}
- beforeEach(jest.useFakeTimers)
+ beforeEach(() => {
+ jest.useFakeTimers()
+ })
describe('given id', () => {
beforeEach(() => {
diff --git a/webapp/components/Modal/ReportModal.spec.js b/webapp/components/Modal/ReportModal.spec.js
index 999adacb4..d993e8103 100644
--- a/webapp/components/Modal/ReportModal.spec.js
+++ b/webapp/components/Modal/ReportModal.spec.js
@@ -1,10 +1,12 @@
-import { config, shallowMount, mount } from '@vue/test-utils'
+import { shallowMount, mount } from '@vue/test-utils'
import ReportModal from './ReportModal.vue'
import Vue from 'vue'
const localVue = global.localVue
-config.stubs['sweetalert-icon'] = ''
+const stubs = {
+ 'sweetalert-icon': true,
+}
describe('ReportModal.vue', () => {
let wrapper
@@ -39,6 +41,7 @@ describe('ReportModal.vue', () => {
propsData,
mocks,
localVue,
+ stubs,
})
}
@@ -109,13 +112,16 @@ describe('ReportModal.vue', () => {
propsData,
mocks,
localVue,
+ stubs,
})
}
- beforeEach(jest.useFakeTimers)
+ beforeEach(() => {
+ jest.useFakeTimers()
+ })
it('renders', () => {
- expect(Wrapper().is('div')).toBe(true)
+ expect(Wrapper().element.tagName).toBe('DIV')
})
describe('given id', () => {
diff --git a/webapp/components/Notification/Notification.spec.js b/webapp/components/Notification/Notification.spec.js
index 879bbfb7d..844f78e71 100644
--- a/webapp/components/Notification/Notification.spec.js
+++ b/webapp/components/Notification/Notification.spec.js
@@ -1,12 +1,10 @@
-import { config, mount, RouterLinkStub } from '@vue/test-utils'
+import { mount, RouterLinkStub } from '@vue/test-utils'
import Notification from './Notification.vue'
import Vuex from 'vuex'
const localVue = global.localVue
-config.stubs['client-only'] = ''
-
describe('Notification', () => {
let stubs
let getters
@@ -20,6 +18,7 @@ describe('Notification', () => {
}
stubs = {
NuxtLink: RouterLinkStub,
+ 'client-only': true,
}
getters = {
'auth/user': () => {
diff --git a/webapp/components/NotificationList/NotificationList.spec.js b/webapp/components/NotificationList/NotificationList.spec.js
index 219c1fdbb..4c6d3690a 100644
--- a/webapp/components/NotificationList/NotificationList.spec.js
+++ b/webapp/components/NotificationList/NotificationList.spec.js
@@ -1,4 +1,4 @@
-import { config, shallowMount, mount, RouterLinkStub } from '@vue/test-utils'
+import { shallowMount, mount, RouterLinkStub } from '@vue/test-utils'
import NotificationList from './NotificationList'
import Notification from '../Notification/Notification'
import Vuex from 'vuex'
@@ -9,9 +9,6 @@ const localVue = global.localVue
localVue.filter('truncate', (string) => string)
-config.stubs['client-only'] = ''
-config.stubs['v-popover'] = ''
-
describe('NotificationList.vue', () => {
let wrapper
let mocks
@@ -33,6 +30,8 @@ describe('NotificationList.vue', () => {
}
stubs = {
NuxtLink: RouterLinkStub,
+ 'client-only': true,
+ 'v-popover': true,
}
propsData = { notifications }
})
@@ -44,6 +43,7 @@ describe('NotificationList.vue', () => {
mocks,
store,
localVue,
+ stubs,
})
}
diff --git a/webapp/components/NotificationMenu/NotificationMenu.spec.js b/webapp/components/NotificationMenu/NotificationMenu.spec.js
index 3986471fd..448ea37e4 100644
--- a/webapp/components/NotificationMenu/NotificationMenu.spec.js
+++ b/webapp/components/NotificationMenu/NotificationMenu.spec.js
@@ -1,12 +1,10 @@
-import { config, mount, RouterLinkStub } from '@vue/test-utils'
+import { mount, RouterLinkStub } from '@vue/test-utils'
import NotificationMenu from './NotificationMenu'
const localVue = global.localVue
localVue.filter('truncate', (string) => string)
-config.stubs.dropdown = ''
-
describe('NotificationMenu.vue', () => {
let wrapper
let mocks
@@ -23,6 +21,8 @@ describe('NotificationMenu.vue', () => {
}
stubs = {
NuxtLink: RouterLinkStub,
+ UserTeaser: true,
+ 'client-only': true,
}
})
@@ -38,13 +38,13 @@ describe('NotificationMenu.vue', () => {
it('renders as link without counter', () => {
wrapper = Wrapper()
- expect(wrapper.is('a.notifications-menu')).toBe(true)
+ expect(wrapper.classes('notifications-menu')).toBe(true)
expect(() => wrapper.get('.count')).toThrow()
})
it('no dropdown is rendered', () => {
wrapper = Wrapper()
- expect(wrapper.contains('.dropdown')).toBe(false)
+ expect(wrapper.find('.dropdown').exists()).toBe(false)
})
describe('given only read notifications', () => {
@@ -73,13 +73,13 @@ describe('NotificationMenu.vue', () => {
it('renders as link without counter', () => {
wrapper = Wrapper()
- expect(wrapper.is('a.notifications-menu')).toBe(true)
+ expect(wrapper.classes('notifications-menu')).toBe(true)
expect(() => wrapper.get('.count')).toThrow()
})
it('no dropdown is rendered', () => {
wrapper = Wrapper()
- expect(wrapper.contains('.dropdown')).toBe(false)
+ expect(wrapper.find('.dropdown').exists()).toBe(false)
})
})
@@ -101,6 +101,14 @@ describe('NotificationMenu.vue', () => {
name: 'John Doe',
},
},
+ from: {
+ title: 'Title',
+ author: {
+ id: 'reporter',
+ slug: 'reporter',
+ name: 'reporter',
+ },
+ },
},
{
id: 'notification-42',
@@ -115,6 +123,14 @@ describe('NotificationMenu.vue', () => {
name: 'John Doe',
},
},
+ from: {
+ title: 'Title',
+ author: {
+ id: 'reporter',
+ slug: 'reporter',
+ name: 'reporter',
+ },
+ },
},
{
id: 'notification-43',
@@ -129,6 +145,14 @@ describe('NotificationMenu.vue', () => {
name: 'John Doe',
},
},
+ from: {
+ title: 'Title',
+ author: {
+ id: 'reporter',
+ slug: 'reporter',
+ name: 'reporter',
+ },
+ },
},
],
}
diff --git a/webapp/components/NotificationsTable/NotificationsTable.spec.js b/webapp/components/NotificationsTable/NotificationsTable.spec.js
index b502b5982..e48610034 100644
--- a/webapp/components/NotificationsTable/NotificationsTable.spec.js
+++ b/webapp/components/NotificationsTable/NotificationsTable.spec.js
@@ -1,4 +1,4 @@
-import { config, mount, RouterLinkStub } from '@vue/test-utils'
+import { mount, RouterLinkStub } from '@vue/test-utils'
import Vuex from 'vuex'
import NotificationsTable from './NotificationsTable'
@@ -8,8 +8,6 @@ const localVue = global.localVue
localVue.filter('truncate', (string) => string)
-config.stubs['client-only'] = ''
-
describe('NotificationsTable.vue', () => {
let wrapper, mocks, propsData, stubs
const postNotification = notifications[0]
@@ -21,6 +19,7 @@ describe('NotificationsTable.vue', () => {
}
stubs = {
NuxtLink: RouterLinkStub,
+ 'client-only': true,
}
propsData = {}
})
diff --git a/webapp/components/PageFooter/PageFooter.spec.js b/webapp/components/PageFooter/PageFooter.spec.js
index 53302192a..b02541fbf 100644
--- a/webapp/components/PageFooter/PageFooter.spec.js
+++ b/webapp/components/PageFooter/PageFooter.spec.js
@@ -1,10 +1,14 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import PageFooter from './PageFooter.vue'
import linksDefault from '~/constants/links.js'
const localVue = global.localVue
-config.stubs['nuxt-link'] = ''
+const stubs = {
+ 'nuxt-link': {
+ template: '',
+ },
+}
describe('PageFooter.vue', () => {
let mocks
@@ -21,7 +25,7 @@ describe('PageFooter.vue', () => {
describe('mount', () => {
const Wrapper = () => {
- return mount(PageFooter, { mocks, localVue })
+ return mount(PageFooter, { mocks, localVue, stubs })
}
describe('links.js', () => {
diff --git a/webapp/components/Password/Change.spec.js b/webapp/components/Password/Change.spec.js
index 95b7c1a3a..ea5c392a9 100644
--- a/webapp/components/Password/Change.spec.js
+++ b/webapp/components/Password/Change.spec.js
@@ -90,9 +90,8 @@ describe('ChangePassword.vue', () => {
})
describe('submit form', () => {
- beforeEach(async (done) => {
+ beforeEach(async () => {
await wrapper.find('form').trigger('submit')
- done()
})
it('calls changePassword mutation', () => {
diff --git a/webapp/components/PasswordReset/ChangePassword.spec.js b/webapp/components/PasswordReset/ChangePassword.spec.js
index cef110798..f885203c8 100644
--- a/webapp/components/PasswordReset/ChangePassword.spec.js
+++ b/webapp/components/PasswordReset/ChangePassword.spec.js
@@ -1,9 +1,11 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import ChangePassword from './ChangePassword'
const localVue = global.localVue
-config.stubs['sweetalert-icon'] = ''
+const stubs = {
+ 'sweetalert-icon': true,
+}
describe('ChangePassword ', () => {
let wrapper
@@ -27,13 +29,16 @@ describe('ChangePassword ', () => {
})
describe('mount', () => {
- beforeEach(jest.useFakeTimers)
+ beforeEach(() => {
+ jest.useFakeTimers()
+ })
Wrapper = () => {
return mount(ChangePassword, {
mocks,
propsData,
localVue,
+ stubs,
})
}
diff --git a/webapp/components/PasswordReset/Request.spec.js b/webapp/components/PasswordReset/Request.spec.js
index e601030c6..a30ba70b4 100644
--- a/webapp/components/PasswordReset/Request.spec.js
+++ b/webapp/components/PasswordReset/Request.spec.js
@@ -1,12 +1,8 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import Request from './Request'
const localVue = global.localVue
-config.stubs['sweetalert-icon'] = ''
-config.stubs['client-only'] = ''
-config.stubs['nuxt-link'] = ''
-
describe('Request', () => {
let wrapper, Wrapper, mocks, stubs
@@ -27,11 +23,16 @@ describe('Request', () => {
}
stubs = {
LocaleSwitch: "",
+ 'sweetalert-icon': true,
+ 'client-only': true,
+ 'nuxt-link': true,
}
})
describe('mount', () => {
- beforeEach(jest.useFakeTimers)
+ beforeEach(() => {
+ jest.useFakeTimers()
+ })
Wrapper = () => {
return mount(Request, {
diff --git a/webapp/components/PostTeaser/PostTeaser.spec.js b/webapp/components/PostTeaser/PostTeaser.spec.js
index 546c4581d..7791c62f0 100644
--- a/webapp/components/PostTeaser/PostTeaser.spec.js
+++ b/webapp/components/PostTeaser/PostTeaser.spec.js
@@ -1,4 +1,4 @@
-import { config, shallowMount, mount, RouterLinkStub } from '@vue/test-utils'
+import { shallowMount, mount, RouterLinkStub } from '@vue/test-utils'
import Vuex from 'vuex'
@@ -6,9 +6,6 @@ import PostTeaser from './PostTeaser.vue'
const localVue = global.localVue
-config.stubs['client-only'] = ''
-config.stubs['v-popover'] = ''
-
describe('PostTeaser', () => {
let store
let stubs
@@ -35,6 +32,8 @@ describe('PostTeaser', () => {
}
stubs = {
NuxtLink: RouterLinkStub,
+ 'client-only': true,
+ 'v-popover': true,
}
mocks = {
$t: jest.fn(),
@@ -77,7 +76,9 @@ describe('PostTeaser', () => {
spy.mockReset()
})
- beforeEach(jest.useFakeTimers)
+ beforeEach(() => {
+ jest.useFakeTimers()
+ })
describe('test Post callbacks', () => {
beforeEach(() => {
diff --git a/webapp/components/Registration/Signup.spec.js b/webapp/components/Registration/Signup.spec.js
index dda0cbb9d..7ef2dc994 100644
--- a/webapp/components/Registration/Signup.spec.js
+++ b/webapp/components/Registration/Signup.spec.js
@@ -1,10 +1,12 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import Signup, { SignupMutation } from './Signup'
const localVue = global.localVue
-config.stubs['sweetalert-icon'] = ''
-config.stubs['nuxt-link'] = ''
+const stubs = {
+ 'sweetalert-icon': true,
+ 'nuxt-link': true,
+}
describe('Signup', () => {
let wrapper
@@ -28,13 +30,16 @@ describe('Signup', () => {
})
describe('mount', () => {
- beforeEach(jest.useFakeTimers)
+ beforeEach(() => {
+ jest.useFakeTimers()
+ })
Wrapper = () => {
return mount(Signup, {
mocks,
propsData,
localVue,
+ stubs,
})
}
diff --git a/webapp/components/RelativeDateTime/spec.js b/webapp/components/RelativeDateTime/spec.js
index 833baae3a..b0dd687b2 100644
--- a/webapp/components/RelativeDateTime/spec.js
+++ b/webapp/components/RelativeDateTime/spec.js
@@ -42,7 +42,7 @@ describe('RelativeDateTime', () => {
})
it('renders', () => {
- expect(Wrapper().is('span')).toBe(true)
+ expect(Wrapper().element.tagName).toBe('SPAN')
})
describe("locale == 'en'", () => {
diff --git a/webapp/components/ReleaseModal/ReleaseModal.spec.js b/webapp/components/ReleaseModal/ReleaseModal.spec.js
index 9cded646f..a976e37e5 100644
--- a/webapp/components/ReleaseModal/ReleaseModal.spec.js
+++ b/webapp/components/ReleaseModal/ReleaseModal.spec.js
@@ -100,7 +100,9 @@ describe('ReleaseModal.vue', () => {
})
}
- beforeEach(jest.useFakeTimers)
+ beforeEach(() => {
+ jest.useFakeTimers()
+ })
describe('given id', () => {
beforeEach(() => {
diff --git a/webapp/components/SocialMedia/SocialMedia.spec.js b/webapp/components/SocialMedia/SocialMedia.spec.js
index 420fbeaf2..5aa8220ae 100644
--- a/webapp/components/SocialMedia/SocialMedia.spec.js
+++ b/webapp/components/SocialMedia/SocialMedia.spec.js
@@ -1,8 +1,10 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import SocialMedia from './SocialMedia.vue'
-config.stubs['ds-space'] = ''
-config.stubs['ds-text'] = ''
+const stubs = {
+ 'ds-space': true,
+ 'ds-text': true,
+}
describe('SocialMedia.vue', () => {
let propsData
@@ -18,7 +20,7 @@ describe('SocialMedia.vue', () => {
describe('mount', () => {
const Wrapper = () => {
- return mount(SocialMedia, { propsData, mocks })
+ return mount(SocialMedia, { propsData, mocks, stubs })
}
describe('socialMedia card title', () => {
diff --git a/webapp/components/_new/features/SearchResults/SearchResults.spec.js b/webapp/components/_new/features/SearchResults/SearchResults.spec.js
index 19653fcac..ace02bd46 100644
--- a/webapp/components/_new/features/SearchResults/SearchResults.spec.js
+++ b/webapp/components/_new/features/SearchResults/SearchResults.spec.js
@@ -1,4 +1,4 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import Vuex from 'vuex'
import SearchResults from './SearchResults'
import helpers from '~/storybook/helpers'
@@ -9,8 +9,10 @@ const localVue = global.localVue
localVue.directive('scrollTo', jest.fn())
-config.stubs['client-only'] = ''
-config.stubs['nuxt-link'] = ''
+const stubs = {
+ 'client-only': true,
+ 'nuxt-link': true,
+}
describe('SearchResults', () => {
let mocks, getters, propsData, wrapper
@@ -18,7 +20,7 @@ describe('SearchResults', () => {
const store = new Vuex.Store({
getters,
})
- return mount(SearchResults, { mocks, localVue, propsData, store })
+ return mount(SearchResults, { mocks, localVue, propsData, store, stubs })
}
beforeEach(() => {
diff --git a/webapp/components/_new/generic/TabNavigation/TabNavigation.spec.js b/webapp/components/_new/generic/TabNavigation/TabNavigation.spec.js
index 76ce9665a..f545839ef 100644
--- a/webapp/components/_new/generic/TabNavigation/TabNavigation.spec.js
+++ b/webapp/components/_new/generic/TabNavigation/TabNavigation.spec.js
@@ -1,14 +1,16 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import TabNavigation from './TabNavigation'
const localVue = global.localVue
-config.stubs['client-only'] = ''
+const stubs = {
+ 'client-only': true,
+}
describe('TabNavigation', () => {
let mocks, propsData, wrapper
const Wrapper = () => {
- return mount(TabNavigation, { mocks, localVue, propsData })
+ return mount(TabNavigation, { mocks, localVue, propsData, stubs })
}
beforeEach(() => {
diff --git a/webapp/components/features/FiledReportsTable/FiledReportsTable.spec.js b/webapp/components/features/FiledReportsTable/FiledReportsTable.spec.js
index 4931ea6c6..7a99e85aa 100644
--- a/webapp/components/features/FiledReportsTable/FiledReportsTable.spec.js
+++ b/webapp/components/features/FiledReportsTable/FiledReportsTable.spec.js
@@ -1,4 +1,4 @@
-import { config, mount, RouterLinkStub } from '@vue/test-utils'
+import { mount, RouterLinkStub } from '@vue/test-utils'
import Vuex from 'vuex'
import FiledReportsTable from './FiledReportsTable'
import { reports } from '~/components/features/ReportList/ReportList.story.js'
@@ -7,8 +7,6 @@ const localVue = global.localVue
localVue.filter('truncate', (string) => string)
-config.stubs['client-only'] = ''
-
describe('FiledReportsTable.vue', () => {
let wrapper, mocks, propsData, stubs, filed
@@ -18,6 +16,7 @@ describe('FiledReportsTable.vue', () => {
}
stubs = {
NuxtLink: RouterLinkStub,
+ 'client-only': true,
}
propsData = {}
})
diff --git a/webapp/components/features/ProfileList/FollowList.spec.js b/webapp/components/features/ProfileList/FollowList.spec.js
index 44a855eed..07214ae38 100644
--- a/webapp/components/features/ProfileList/FollowList.spec.js
+++ b/webapp/components/features/ProfileList/FollowList.spec.js
@@ -1,4 +1,4 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import Vuex from 'vuex'
import helpers from '~/storybook/helpers'
@@ -6,9 +6,11 @@ import FollowList from './FollowList.vue'
const localVue = global.localVue
-config.stubs['client-only'] = ''
-config.stubs['ds-space'] = ''
-config.stubs['nuxt-link'] = ''
+const stubs = {
+ 'client-only': true,
+ 'ds-space': true,
+ 'nuxt-link': true,
+}
const user = {
...helpers.fakeUser()[0],
@@ -45,6 +47,7 @@ describe('FollowList.vue', () => {
$t: jest.fn((str) => str),
},
localVue,
+ stubs,
})
beforeAll(() => {
@@ -138,11 +141,11 @@ describe('FollowList.vue', () => {
})
it('renders the user-teasers as an overflowing list', () => {
- expect(wrapper.find('.--overflow').is('ul')).toBe(true)
+ expect(wrapper.find('.--overflow').element.tagName).toBe('UL')
})
it('renders a filter text input', () => {
- expect(wrapper.find('[name="followingFilter"]').is('input')).toBe(true)
+ expect(wrapper.find('[name="followingFilter"]').element.tagName).toBe('INPUT')
})
})
})
diff --git a/webapp/components/features/ReportList/ReportList.spec.js b/webapp/components/features/ReportList/ReportList.spec.js
index d4dbc7132..84848ce82 100644
--- a/webapp/components/features/ReportList/ReportList.spec.js
+++ b/webapp/components/features/ReportList/ReportList.spec.js
@@ -1,4 +1,4 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import Vuex from 'vuex'
import ReportList from './ReportList'
import { reports } from './ReportList.story'
@@ -7,8 +7,10 @@ import DropdownFilter from '~/components/DropdownFilter/DropdownFilter'
const localVue = global.localVue
-config.stubs['client-only'] = ''
-config.stubs['nuxt-link'] = ''
+const stubs = {
+ 'client-only': true,
+ 'nuxt-link': true,
+}
describe('ReportList', () => {
let mocks, mutations, getters, wrapper
@@ -45,7 +47,7 @@ describe('ReportList', () => {
mutations,
getters,
})
- return mount(ReportList, { mocks, localVue, store })
+ return mount(ReportList, { mocks, localVue, store, stubs })
}
describe('renders children components', () => {
diff --git a/webapp/components/features/ReportRow/ReportRow.spec.js b/webapp/components/features/ReportRow/ReportRow.spec.js
index b541a40d9..6a4bf922e 100644
--- a/webapp/components/features/ReportRow/ReportRow.spec.js
+++ b/webapp/components/features/ReportRow/ReportRow.spec.js
@@ -1,4 +1,4 @@
-import { config, mount, RouterLinkStub } from '@vue/test-utils'
+import { mount, RouterLinkStub } from '@vue/test-utils'
import Vuex from 'vuex'
import ReportRow from './ReportRow.vue'
import BaseIcon from '~/components/_new/generic/BaseIcon/BaseIcon'
@@ -6,8 +6,6 @@ import { reports } from '~/components/features/ReportList/ReportList.story.js'
const localVue = global.localVue
-config.stubs['client-only'] = ''
-
describe('ReportRow', () => {
let propsData, mocks, stubs, getters, wrapper
@@ -18,6 +16,7 @@ describe('ReportRow', () => {
}
stubs = {
NuxtLink: RouterLinkStub,
+ 'client-only': true,
}
getters = {
'auth/user': () => {
diff --git a/webapp/components/features/ReportsTable/ReportsTable.spec.js b/webapp/components/features/ReportsTable/ReportsTable.spec.js
index c80e4fea5..688139eec 100644
--- a/webapp/components/features/ReportsTable/ReportsTable.spec.js
+++ b/webapp/components/features/ReportsTable/ReportsTable.spec.js
@@ -1,12 +1,14 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import Vuex from 'vuex'
import ReportsTable from './ReportsTable.vue'
import { reports } from '~/components/features/ReportList/ReportList.story.js'
const localVue = global.localVue
-config.stubs['client-only'] = ''
-config.stubs['nuxt-link'] = ''
+const stubs = {
+ 'client-only': true,
+ 'nuxt-link': true,
+}
describe('ReportsTable', () => {
let propsData, mocks, getters, wrapper, reportsTable
@@ -29,7 +31,7 @@ describe('ReportsTable', () => {
const store = new Vuex.Store({
getters,
})
- return mount(ReportsTable, { propsData, mocks, localVue, store })
+ return mount(ReportsTable, { propsData, mocks, localVue, store, stubs })
}
describe('given no reports', () => {
diff --git a/webapp/components/features/SearchField/SearchField.spec.js b/webapp/components/features/SearchField/SearchField.spec.js
index 140b55caa..ec5276212 100644
--- a/webapp/components/features/SearchField/SearchField.spec.js
+++ b/webapp/components/features/SearchField/SearchField.spec.js
@@ -1,4 +1,4 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import Vuex from 'vuex'
import SearchField from './SearchField.vue'
import SearchableInput from '~/components/generic/SearchableInput/SearchableInput'
@@ -7,7 +7,10 @@ const localVue = global.localVue
localVue.filter('truncate', () => 'truncated string')
localVue.filter('dateTime', () => Date.now)
-config.stubs['nuxt-link'] = ''
+
+const stubs = {
+ 'nuxt-link': true,
+}
describe('SearchField.vue', () => {
let mocks, wrapper, getters
@@ -26,7 +29,7 @@ describe('SearchField.vue', () => {
const store = new Vuex.Store({
getters,
})
- return mount(SearchField, { mocks, localVue, store })
+ return mount(SearchField, { mocks, localVue, store, stubs })
}
describe('mount', () => {
diff --git a/webapp/components/generic/SearchPost/SearchPost.spec.js b/webapp/components/generic/SearchPost/SearchPost.spec.js
index 3e05c9d74..3c690e39c 100644
--- a/webapp/components/generic/SearchPost/SearchPost.spec.js
+++ b/webapp/components/generic/SearchPost/SearchPost.spec.js
@@ -37,11 +37,11 @@ describe('SearchPost.vue', () => {
})
it('renders post commentsCount', () => {
- expect(counts.text()).toContain(propsData.option.commentsCount)
+ expect(counts.text()).toContain(propsData.option.commentsCount.toString())
})
it('renders post shoutedCount', () => {
- expect(counts.text()).toContain(propsData.option.shoutedCount)
+ expect(counts.text()).toContain(propsData.option.shoutedCount.toString())
})
it('renders post author', () => {
diff --git a/webapp/components/generic/SearchableInput/SearchableInput.spec.js b/webapp/components/generic/SearchableInput/SearchableInput.spec.js
index e0e9f9831..cda9150b8 100644
--- a/webapp/components/generic/SearchableInput/SearchableInput.spec.js
+++ b/webapp/components/generic/SearchableInput/SearchableInput.spec.js
@@ -1,4 +1,4 @@
-import { config, mount } from '@vue/test-utils'
+import { mount } from '@vue/test-utils'
import Vuex from 'vuex'
import Vue from 'vue'
import SearchableInput from './SearchableInput'
@@ -8,7 +8,10 @@ const localVue = global.localVue
localVue.filter('truncate', () => 'truncated string')
localVue.filter('dateTime', () => Date.now)
-config.stubs['nuxt-link'] = ''
+
+const stubs = {
+ 'nuxt-link': true,
+}
describe('SearchableInput.vue', () => {
let mocks, propsData, getters, wrapper
@@ -28,7 +31,7 @@ describe('SearchableInput.vue', () => {
const store = new Vuex.Store({
getters,
})
- return mount(SearchableInput, { mocks, localVue, propsData, store })
+ return mount(SearchableInput, { mocks, localVue, propsData, store, stubs })
}
describe('mount', () => {