From 4ad268e86ce4c24618769b6a8d52c7d31c57c1c6 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 3 Mar 2022 10:13:14 +0100 Subject: [PATCH] add tests specs for Transaction slots --- .../Transactions/TransactionCreation.spec.js | 52 +++++++++++++++++++ .../Transactions/TransactionCreation.vue | 13 ++--- .../Transactions/TransactionDecay.spec.js | 52 +++++++++++++++++++ .../Transactions/TransactionDecay.vue | 7 +-- .../Transactions/TransactionReceive.spec.js | 52 +++++++++++++++++++ .../Transactions/TransactionReceive.vue | 14 ++--- .../Transactions/TransactionSend.spec.js | 52 +++++++++++++++++++ .../Transactions/TransactionSend.vue | 14 ++--- .../AccountOverview/GddTransactionList.vue | 43 ++------------- 9 files changed, 225 insertions(+), 74 deletions(-) create mode 100644 frontend/src/components/Transactions/TransactionCreation.spec.js create mode 100644 frontend/src/components/Transactions/TransactionDecay.spec.js create mode 100644 frontend/src/components/Transactions/TransactionReceive.spec.js create mode 100644 frontend/src/components/Transactions/TransactionSend.spec.js diff --git a/frontend/src/components/Transactions/TransactionCreation.spec.js b/frontend/src/components/Transactions/TransactionCreation.spec.js new file mode 100644 index 000000000..62de8a9a2 --- /dev/null +++ b/frontend/src/components/Transactions/TransactionCreation.spec.js @@ -0,0 +1,52 @@ +import { mount } from '@vue/test-utils' +import TransactionCreation from './TransactionCreation' + +const localVue = global.localVue + +const mocks = { + $i18n: { + locale: 'en', + }, + $n: jest.fn((n) => n), + $t: jest.fn((t) => t), + $d: jest.fn((d) => d), +} + +const propsData = { + amount: '12.45', + balance: '31.76099091058521', + balanceDate: '2022-02-28T13:55:47.000Z', + decay: { + decay: '-0.2038314055482643084', + start: '2022-02-25T07:29:26.000Z', + end: '2022-02-28T13:55:47.000Z', + duration: 282381, + __typename: 'CREATION', + }, + id: 9, + linkedUser: { + firstName: 'Bibi', + lastName: 'Bloxberg', + __typename: 'User', + }, + memo: 'sadasd asdasdasdasdadadd da dad aad', + typeId: 'DECAY', + decayStartBlock: new Date('2021-05-13T17:46:31.000Z'), +} + +describe('TransactionCreation', () => { + let wrapper + + const Wrapper = () => { + return mount(TransactionCreation, { localVue, mocks, propsData }) + } + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders the component transaction-slot-creation', () => { + expect(wrapper.find('div.transaction-slot-creation').exists()).toBeTruthy() + }) + }) +}) diff --git a/frontend/src/components/Transactions/TransactionCreation.vue b/frontend/src/components/Transactions/TransactionCreation.vue index 74b298ee9..bc83edc77 100644 --- a/frontend/src/components/Transactions/TransactionCreation.vue +++ b/frontend/src/components/Transactions/TransactionCreation.vue @@ -1,8 +1,8 @@