From 69a6566c4b394b33d9cc18b817de652dc5d99acd Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 8 Sep 2021 11:02:21 +0200 Subject: [PATCH] fix locale, add tests --- frontend/src/components/Transaction.spec.js | 36 ++++++++ frontend/src/components/Transaction.vue | 82 +++++++++---------- .../src/components/TransactionCollaps.spec.js | 36 ++++++++ .../src/components/TransactionCollaps.vue | 12 ++- frontend/src/locales/de.json | 6 +- frontend/src/locales/en.json | 3 +- .../AccountOverview/GdtTransactionList.vue | 1 - 7 files changed, 129 insertions(+), 47 deletions(-) create mode 100644 frontend/src/components/Transaction.spec.js create mode 100644 frontend/src/components/TransactionCollaps.spec.js diff --git a/frontend/src/components/Transaction.spec.js b/frontend/src/components/Transaction.spec.js new file mode 100644 index 000000000..e5e0c89f0 --- /dev/null +++ b/frontend/src/components/Transaction.spec.js @@ -0,0 +1,36 @@ +import { mount } from '@vue/test-utils' +import Transaction from './Transaction' + +const localVue = global.localVue + +const toastErrorMock = jest.fn() + +describe('Transaction', () => { + let wrapper + + const mocks = { + $i18n: { + locale: 'en', + }, + $t: jest.fn((t) => t), + $n: jest.fn((n) => n), + $d: jest.fn((d) => d), + $toasted: { + error: toastErrorMock, + }, + } + + const Wrapper = () => { + return mount(Transaction, { localVue, mocks }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders the component', () => { + expect(wrapper.find('div.gdt-transaction-list-item').exists()).toBeTruthy() + }) + }) +}) diff --git a/frontend/src/components/Transaction.vue b/frontend/src/components/Transaction.vue index e1884a3e3..faf347a41 100644 --- a/frontend/src/components/Transaction.vue +++ b/frontend/src/components/Transaction.vue @@ -1,17 +1,16 @@