From 0db297a267ae01a5f133cb2892869e56e187b502 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 20 Jan 2022 14:13:10 +0100 Subject: [PATCH] fix test --- admin/src/components/EditCreationFormular.spec.js | 13 ++++++++----- admin/src/components/EditCreationFormular.vue | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/admin/src/components/EditCreationFormular.spec.js b/admin/src/components/EditCreationFormular.spec.js index 23b685f39..3915fd828 100644 --- a/admin/src/components/EditCreationFormular.spec.js +++ b/admin/src/components/EditCreationFormular.spec.js @@ -20,7 +20,10 @@ const toastedSuccessMock = jest.fn() const mocks = { $t: jest.fn((t) => t), - $d: jest.fn((d) => d), + $d: jest.fn((d) => { + const date = new Date(d) + return date.toISOString().split('T')[0] + }), $apollo: { mutate: apolloMutateMock, }, @@ -44,7 +47,7 @@ const propsData = { creationUserData: { memo: 'Test schöpfung 1', amount: 100, - date: '2021-12-01', + date: '2022-01-20', }, item: { id: 0, @@ -105,7 +108,7 @@ describe('EditCreationFormular', () => { expect.objectContaining({ variables: { amount: 90, - creationDate: 'YYYY-MM-01', + creationDate: '2021-10-31', email: 'bob@baumeister.de', id: 0, memo: 'Test create coins', @@ -177,7 +180,7 @@ describe('EditCreationFormular', () => { expect.objectContaining({ variables: { amount: 90, - creationDate: 'YYYY-MM-01', + creationDate: '2021-11-30', email: 'bob@baumeister.de', id: 0, memo: 'Test create coins', @@ -233,7 +236,7 @@ describe('EditCreationFormular', () => { expect.objectContaining({ variables: { amount: 90, - creationDate: 'YYYY-MM-DD', + creationDate: '2022-01-20', email: 'bob@baumeister.de', id: 0, memo: 'Test create coins', diff --git a/admin/src/components/EditCreationFormular.vue b/admin/src/components/EditCreationFormular.vue index 34f4d6101..97c503ad5 100644 --- a/admin/src/components/EditCreationFormular.vue +++ b/admin/src/components/EditCreationFormular.vue @@ -242,7 +242,7 @@ export default { }, created() { if (this.creationUserData.date) { - switch (this.$moment(this.creationUserData.date).format('MMMM')) { + switch (this.$d(new Date(this.creationUserData.date), 'month')) { case this.currentMonth.short: this.createdIndex = 2 this.radioSelected = this.currentMonth