improve tests by checking presence of components instead of internal data

This commit is contained in:
Moriz Wahl 2021-07-07 17:21:11 +02:00
parent d50806bf50
commit f12019e291
2 changed files with 5 additions and 5 deletions

View File

@ -51,13 +51,13 @@ describe('AccountOverview', () => {
})
describe('transaction form', () => {
it('steps forward in the dialog', () => {
wrapper.findComponent({ name: 'TransactionForm' }).vm.$emit('set-transaction', {
it('steps forward in the dialog', async () => {
await wrapper.findComponent({ name: 'TransactionForm' }).vm.$emit('set-transaction', {
email: 'user@example.org',
amount: 23.45,
memo: 'Make the best of it!',
})
expect(wrapper.vm.currentTransactionStep).toBe(1)
expect(wrapper.findComponent({ name: 'TransactionConfirmation' }).exists()).toBeTruthy()
})
})
@ -75,7 +75,7 @@ describe('AccountOverview', () => {
it('resets the transaction process when on-reset is emitted', async () => {
await wrapper.findComponent({ name: 'TransactionConfirmation' }).vm.$emit('on-reset')
expect(wrapper.vm.currentTransactionStep).toBe(0)
expect(wrapper.findComponent({ name: 'TransactionForm' }).exists()).toBeTruthy()
expect(wrapper.vm.transactionData).toEqual({
email: '',
amount: 0,

View File

@ -94,7 +94,7 @@ export default {
},
methods: {
setTransaction(data) {
this.transactionData = data
this.transactionData = { ...data }
this.currentTransactionStep = 1
},
async sendTransaction() {