From b11b3c77520587785014f93050ca518e8436cf36 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 26 May 2021 15:36:56 +0200 Subject: [PATCH] test GddTransactionListFooter --- .../GddTransactionListFooter.spec.js | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 frontend/src/views/Pages/AccountOverview/GddTransactionListFooter.spec.js diff --git a/frontend/src/views/Pages/AccountOverview/GddTransactionListFooter.spec.js b/frontend/src/views/Pages/AccountOverview/GddTransactionListFooter.spec.js new file mode 100644 index 000000000..8457d2ad3 --- /dev/null +++ b/frontend/src/views/Pages/AccountOverview/GddTransactionListFooter.spec.js @@ -0,0 +1,48 @@ +import { mount, RouterLinkStub } from '@vue/test-utils' +import GddTransactionListFooter from './GddTransactionListFooter' + +const localVue = global.localVue + +describe('GddTransactionListFooter', () => { + let wrapper + + const mocks = { + $t: jest.fn((t) => t), + } + + const stubs = { + RouterLink: RouterLinkStub, + } + + const Wrapper = () => { + return mount(GddTransactionListFooter, { localVue, mocks, stubs }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders the component', () => { + expect(wrapper.find('div.list-group').exists()).toBeTruthy() + }) + + it('contains no text', () => { + expect(wrapper.text()).toBe('') + }) + }) + + describe('count property is greater than 5', () => { + beforeEach(async () => { + wrapper.setProps({ count: 6 }) + }) + + it('renders a link to show all', () => { + expect(wrapper.text()).toBe('transaction.show_all') + }) + + it('links to /transactions', () => { + expect(wrapper.findComponent(RouterLinkStub).props().to).toBe('/transactions') + }) + }) +})