Write tests

This commit is contained in:
Wolfgang Huß 2021-05-06 16:59:01 +02:00
parent da951c6fb6
commit 124d752e38
2 changed files with 28 additions and 8 deletions

View File

@ -253,7 +253,8 @@
},
"donations": {
"amount-of-total": "{amount} of {total} € collezionato",
"donate-now": "Dona ora" },
"donate-now": "Dona ora"
},
"editor": {
"embed": {
"always_allow": null,

View File

@ -1,5 +1,6 @@
import { config, shallowMount, mount } from '@vue/test-utils'
import PostIndex from './index.vue'
import Vue from 'vue'
import Vuex from 'vuex'
import HashtagsFilter from '~/components/HashtagsFilter/HashtagsFilter'
@ -93,14 +94,32 @@ describe('PostIndex', () => {
wrapper.find(HashtagsFilter).vm.$emit('clearSearch')
expect(wrapper.vm.hashtag).toBeNull()
})
})
describe('mount', () => {
beforeEach(() => {
wrapper = mount(PostIndex, {
store,
mocks,
localVue,
})
describe('mount', () => {
Wrapper = () => {
return mount(PostIndex, {
store,
mocks,
localVue,
})
}
beforeEach(() => {
wrapper = Wrapper()
})
describe('donation-info', () => {
it('shows donation-info on default', () => {
wrapper = Wrapper()
expect(wrapper.find('.top-info-bar').exists()).toBe(true)
})
it('hides donation-info if not "showDonations"', () => {
wrapper = Wrapper()
wrapper.setData({ showDonations: false })
Vue.nextTick()
expect(wrapper.find('.top-info-bar').exists()).toBe(false)
})
})
})