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": { "donations": {
"amount-of-total": "{amount} of {total} € collezionato", "amount-of-total": "{amount} of {total} € collezionato",
"donate-now": "Dona ora" }, "donate-now": "Dona ora"
},
"editor": { "editor": {
"embed": { "embed": {
"always_allow": null, "always_allow": null,

View File

@ -1,5 +1,6 @@
import { config, shallowMount, mount } from '@vue/test-utils' import { config, shallowMount, mount } from '@vue/test-utils'
import PostIndex from './index.vue' import PostIndex from './index.vue'
import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
import HashtagsFilter from '~/components/HashtagsFilter/HashtagsFilter' import HashtagsFilter from '~/components/HashtagsFilter/HashtagsFilter'
@ -93,14 +94,32 @@ describe('PostIndex', () => {
wrapper.find(HashtagsFilter).vm.$emit('clearSearch') wrapper.find(HashtagsFilter).vm.$emit('clearSearch')
expect(wrapper.vm.hashtag).toBeNull() expect(wrapper.vm.hashtag).toBeNull()
}) })
})
describe('mount', () => { describe('mount', () => {
beforeEach(() => { Wrapper = () => {
wrapper = mount(PostIndex, { return mount(PostIndex, {
store, store,
mocks, mocks,
localVue, 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)
}) })
}) })
}) })