fix donations test

This commit is contained in:
Moriz Wahl 2023-02-13 21:33:35 +01:00
parent b3f50e04d8
commit 0d5f87c2a3

View File

@ -57,7 +57,7 @@ describe('donations.vue', () => {
}) })
it('renders', () => { it('renders', () => {
expect(wrapper.is('.base-card')).toBe(true) expect(wrapper.classes('base-card')).toBe(true)
}) })
describe('displays', () => { describe('displays', () => {
@ -89,23 +89,19 @@ describe('donations.vue', () => {
describe('form component click', () => { describe('form component click', () => {
it('on #showDonations checkbox changes "showDonations" to true', async () => { it('on #showDonations checkbox changes "showDonations" to true', async () => {
// starts with false // starts with false
wrapper.find('#showDonations').trigger('click') // set to true await wrapper.find('#showDonations').setChecked(true) // set to true
await wrapper.vm.$nextTick()
expect(wrapper.vm.showDonations).toBe(true) expect(wrapper.vm.showDonations).toBe(true)
}) })
it('on #showDonations checkbox twice changes "showDonations" back to false', async () => { it('on #showDonations checkbox twice changes "showDonations" back to false', async () => {
// starts with false // starts with false
wrapper.find('#showDonations').trigger('click') // set to true await wrapper.find('#showDonations').setChecked(true) // set to true
wrapper.find('#showDonations').trigger('click') // set to false await wrapper.find('#showDonations').setChecked(false) // set to true
await wrapper.vm.$nextTick()
expect(wrapper.vm.showDonations).toBe(false) expect(wrapper.vm.showDonations).toBe(false)
}) })
it.skip('on donations-goal and enter value XXX', async () => { it.skip('on donations-goal and enter value XXX', async () => {
wrapper.find('#donations-goal').setValue('20000') await wrapper.find('#donations-goal').setValue('20000')
await wrapper.vm.$nextTick()
// console.log(wrapper.find('#donations-goal').element.value)
expect(wrapper.vm.formData.goal).toBe('20000') expect(wrapper.vm.formData.goal).toBe('20000')
}) })
}) })
@ -141,7 +137,7 @@ describe('donations.vue', () => {
}) })
it('calls mutation with input values once', async () => { it('calls mutation with input values once', async () => {
wrapper.find('#showDonations').trigger('click') // set to true wrapper.find('#showDonations').setChecked(true) // set to true
await wrapper.vm.$nextTick() await wrapper.vm.$nextTick()
wrapper.find('#donations-goal').setValue('20000') wrapper.find('#donations-goal').setValue('20000')
await wrapper.vm.$nextTick() await wrapper.vm.$nextTick()