feat: Test UserProfileTransactionList

This commit is contained in:
Moriz Wahl 2021-07-12 11:11:54 +02:00
parent 913a4deff1
commit c3457b409b
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,33 @@
import { mount } from '@vue/test-utils'
import UserProfileTransactionList from './UserProfileTransactionList'
const localVue = global.localVue
describe('UserProfileTransactionList', () => {
let wrapper
const mocks = {
$t: jest.fn((t) => t),
}
const Wrapper = () => {
return mount(UserProfileTransactionList, { localVue, mocks })
}
describe('mount', () => {
beforeEach(() => {
wrapper = Wrapper()
})
it('renders the transaction table', () => {
expect(wrapper.findComponent({ name: 'GddTransactionList' }).exists()).toBeTruthy()
})
it('emist update-transactions when update-transactions is called', async () => {
wrapper.findComponent({ name: 'GddTransactionList' }).vm.$emit('update-transactions')
expect(wrapper.emitted('update-transactions')).toEqual(
expect.arrayContaining([expect.arrayContaining([{ firstPage: 1, items: 25 }])]),
)
})
})
})

View File

@ -19,12 +19,13 @@
import GddTransactionList from './AccountOverview/GddTransactionList.vue'
export default {
name: 'UserProfileTransactionList',
components: {
GddTransactionList,
},
props: {
transactions: {
default: [],
default: () => [],
},
transactionCount: { type: Number, default: 0 },
},