src/components/Transactions/TransactionLinksSummary.spec.js

This commit is contained in:
Moriz Wahl 2022-03-17 20:06:24 +01:00
parent b75330c142
commit b8d4366e46

View File

@ -5,52 +5,7 @@ import { toastErrorSpy } from '@test/testSetup'
const localVue = global.localVue const localVue = global.localVue
const apolloQueryMock = jest.fn().mockResolvedValue({ const apolloQueryMock = jest.fn()
data: {
listTransactionLinks: [
{
amount: '75',
code: 'ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111',
id: 86,
memo: 'Na komm schon. Etwas Kreativität.',
redeemedAt: null,
validUntil: '2022-03-30T14:22:40.000Z',
},
{
amount: '85',
code: 'ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111',
id: 107,
memo: 'asdasdaadsdd asd asdadss',
redeemedAt: null,
validUntil: '2022-03-30T14:22:40.000Z',
},
{
amount: '95',
code: 'ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111',
id: 92,
memo: 'asdasdaadsdd asd asdadss',
redeemedAt: null,
validUntil: '2022-03-30T14:22:40.000Z',
},
{
amount: '150',
code: 'ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111',
id: 16,
memo: 'asdasdaadsdd asd asdadss',
redeemedAt: null,
validUntil: '2022-03-30T14:22:40.000Z',
},
],
},
})
const mocks = { const mocks = {
$i18n: { $i18n: {
@ -80,8 +35,56 @@ describe('TransactionLinksSummary', () => {
const Wrapper = () => { const Wrapper = () => {
return mount(TransactionLinksSummary, { localVue, mocks, propsData }) return mount(TransactionLinksSummary, { localVue, mocks, propsData })
} }
describe('mount', () => { describe('mount', () => {
beforeEach(() => { beforeEach(() => {
apolloQueryMock.mockResolvedValue({
data: {
listTransactionLinks: [
{
amount: '75',
code: 'ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111',
id: 86,
memo: 'Na komm schon. Etwas Kreativität.',
redeemedAt: null,
validUntil: '2022-03-30T14:22:40.000Z',
},
{
amount: '85',
code: 'ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111',
id: 107,
memo: 'asdasdaadsdd asd asdadss',
redeemedAt: null,
validUntil: '2022-03-30T14:22:40.000Z',
},
{
amount: '95',
code: 'ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111',
id: 92,
memo: 'asdasdaadsdd asd asdadss',
redeemedAt: null,
validUntil: '2022-03-30T14:22:40.000Z',
},
{
amount: '150',
code: 'ce28664b5308c17f931c0367',
createdAt: '2022-03-16T14:22:40.000Z',
holdAvailableAmount: '5.13109484759482747111',
id: 16,
memo: 'asdasdaadsdd asd asdadss',
redeemedAt: null,
validUntil: '2022-03-30T14:22:40.000Z',
},
],
},
})
wrapper = Wrapper() wrapper = Wrapper()
}) })
@ -132,6 +135,10 @@ describe('TransactionLinksSummary', () => {
it('emits update transactions', () => { it('emits update transactions', () => {
expect(wrapper.emitted('update-transactions')).toBeTruthy() expect(wrapper.emitted('update-transactions')).toBeTruthy()
}) })
it('has four transaction links in list', () => {
expect(wrapper.vm.transactionLinks).toHaveLength(4)
})
}) })
describe('load more transaction links', () => { describe('load more transaction links', () => {