From 78a1459971b5adfac96a303a2f2dabbd146dde4e Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 17 Mar 2022 21:47:11 +0100 Subject: [PATCH] =?UTF-8?q?change=20props=20in=20tests=20for=20transaction?= =?UTF-8?q?=20links=20+=20zauberspr=C3=BCche?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CollapseLinksList.spec.js | 28 +++++++++++-------- .../DecayInformations/CollapseLinksList.vue | 11 ++++---- .../TransactionLinksSummary.spec.js | 16 ++++------- .../Transactions/TransactionLinksSummary.vue | 16 ++++------- 4 files changed, 33 insertions(+), 38 deletions(-) diff --git a/frontend/src/components/DecayInformations/CollapseLinksList.spec.js b/frontend/src/components/DecayInformations/CollapseLinksList.spec.js index d09922e3a..b533c6aa1 100644 --- a/frontend/src/components/DecayInformations/CollapseLinksList.spec.js +++ b/frontend/src/components/DecayInformations/CollapseLinksList.spec.js @@ -19,7 +19,7 @@ const propsData = { createdAt: '2022-03-16T14:22:40.000Z', holdAvailableAmount: '5.13109484759482747111', id: 87, - memo: 'asdasdaadsdd asd asdadss', + memo: 'Eene meene Siegerpreis, vor mir steht ein Schokoeis. Hex-hex!', redeemedAt: null, validUntil: '2022-03-30T14:22:40.000Z', }, @@ -29,13 +29,15 @@ const propsData = { createdAt: '2022-03-16T14:22:40.000Z', holdAvailableAmount: '5.13109484759482747111', id: 86, - memo: 'asdasdaadsdd asd asdadss', + memo: 'Eene meene buntes Laub, auf dem Schrank da liegt kein Staub.', redeemedAt: null, validUntil: '2022-03-30T14:22:40.000Z', }, ], transactionLinkCount: 3, - value: { currentPage: 1, pending: false, pageSize: 5 }, + value: 1, + pending: false, + pageSize: 5, } describe('CollapseLinksList', () => { @@ -59,9 +61,7 @@ describe('CollapseLinksList', () => { }) it('emits input', () => { - expect(wrapper.emitted('input')).toEqual([ - [{ currentPage: 2, pageSize: 5, pending: false }], - ]) + expect(wrapper.emitted('input')).toEqual([[2]]) }) }) @@ -73,9 +73,7 @@ describe('CollapseLinksList', () => { }) it('emits input ', () => { - expect(wrapper.emitted('input')).toEqual([ - [{ currentPage: 0, pageSize: 5, pending: false }], - ]) + expect(wrapper.emitted('input')).toEqual([[0]]) }) }) @@ -83,7 +81,9 @@ describe('CollapseLinksList', () => { describe('one more link to load', () => { beforeEach(async () => { await wrapper.setProps({ - value: { currentPage: 1, pending: false, pageSize: 5 }, + value: 1, + pending: false, + pageSize: 5, }) }) @@ -95,7 +95,9 @@ describe('CollapseLinksList', () => { describe('less than pageSize links to load', () => { beforeEach(async () => { await wrapper.setProps({ - value: { currentPage: 1, pending: false, pageSize: 5 }, + value: 1, + pending: false, + pageSize: 5, transactionLinkCount: 6, }) }) @@ -108,7 +110,9 @@ describe('CollapseLinksList', () => { describe('more than pageSize links to load', () => { beforeEach(async () => { await wrapper.setProps({ - value: { currentPage: 1, pending: false, pageSize: 5 }, + value: 1, + pending: false, + pageSize: 5, transactionLinkCount: 16, }) }) diff --git a/frontend/src/components/DecayInformations/CollapseLinksList.vue b/frontend/src/components/DecayInformations/CollapseLinksList.vue index b1e42cd2d..0c1db5f0a 100644 --- a/frontend/src/components/DecayInformations/CollapseLinksList.vue +++ b/frontend/src/components/DecayInformations/CollapseLinksList.vue @@ -42,23 +42,24 @@ export default { type: Number, required: true, }, - value: { type: Object, required: true }, + value: { type: Number, required: true }, + pageSize: { type: Number, default: 5 }, pending: { type: Boolean, default: false }, }, methods: { resetTransactionLinkList() { - this.$emit('input', { ...this.value, currentPage: 0 }) + this.$emit('input', 0) }, loadMoreLinks() { - this.$emit('input', { ...this.value, currentPage: this.value.currentPage + 1 }) + this.$emit('input', this.value + 1) }, }, computed: { buttonText() { const i = this.transactionLinkCount - this.transactionLinks.length if (i === 1) return this.$tc('link-load', 0) - if (i <= this.value.pageSize) return this.$tc('link-load', 1, { n: i }) - return this.$tc('link-load', 2, { n: this.value.pageSize }) + if (i <= this.pageSize) return this.$tc('link-load', 1, { n: i }) + return this.$tc('link-load', 2, { n: this.pageSize }) }, }, } diff --git a/frontend/src/components/Transactions/TransactionLinksSummary.spec.js b/frontend/src/components/Transactions/TransactionLinksSummary.spec.js index 120cd4009..60517a843 100644 --- a/frontend/src/components/Transactions/TransactionLinksSummary.spec.js +++ b/frontend/src/components/Transactions/TransactionLinksSummary.spec.js @@ -117,11 +117,9 @@ describe('TransactionLinksSummary', () => { beforeEach(async () => { jest.clearAllMocks() await wrapper.setData({ - variables: { - currentPage: 0, - pending: false, - pageSize: 5, - }, + currentPage: 0, + pending: false, + pageSize: 5, }) }) @@ -197,11 +195,9 @@ describe('TransactionLinksSummary', () => { }, }) await wrapper.setData({ - variables: { - currentPage: 2, - pending: false, - pageSize: 5, - }, + currentPage: 2, + pending: false, + pageSize: 5, }) }) diff --git a/frontend/src/components/Transactions/TransactionLinksSummary.vue b/frontend/src/components/Transactions/TransactionLinksSummary.vue index 2f9f946af..3f80bfd18 100644 --- a/frontend/src/components/Transactions/TransactionLinksSummary.vue +++ b/frontend/src/components/Transactions/TransactionLinksSummary.vue @@ -26,8 +26,9 @@ @@ -72,10 +73,8 @@ export default { return { visible: false, transactionLinks: [], - variables: { - currentPage: 1, - pageSize: 5, - }, + currentPage: 1, + pageSize: 5, pending: false, } }, @@ -83,7 +82,7 @@ export default { async updateListTransactionLinks() { if (this.currentPage === 0) { this.transactionLinks = [] - this.variables.currentPage = 1 + this.currentPage = 1 } else { this.pending = true this.$apollo @@ -106,11 +105,6 @@ export default { } }, }, - computed: { - currentPage() { - return this.variables.currentPage - }, - }, watch: { currentPage() { this.updateListTransactionLinks()