This commit is contained in:
Moriz Wahl 2022-01-20 14:13:10 +01:00
parent 5e78e4ad07
commit 0db297a267
2 changed files with 9 additions and 6 deletions

View File

@ -20,7 +20,10 @@ const toastedSuccessMock = jest.fn()
const mocks = { const mocks = {
$t: jest.fn((t) => t), $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: { $apollo: {
mutate: apolloMutateMock, mutate: apolloMutateMock,
}, },
@ -44,7 +47,7 @@ const propsData = {
creationUserData: { creationUserData: {
memo: 'Test schöpfung 1', memo: 'Test schöpfung 1',
amount: 100, amount: 100,
date: '2021-12-01', date: '2022-01-20',
}, },
item: { item: {
id: 0, id: 0,
@ -105,7 +108,7 @@ describe('EditCreationFormular', () => {
expect.objectContaining({ expect.objectContaining({
variables: { variables: {
amount: 90, amount: 90,
creationDate: 'YYYY-MM-01', creationDate: '2021-10-31',
email: 'bob@baumeister.de', email: 'bob@baumeister.de',
id: 0, id: 0,
memo: 'Test create coins', memo: 'Test create coins',
@ -177,7 +180,7 @@ describe('EditCreationFormular', () => {
expect.objectContaining({ expect.objectContaining({
variables: { variables: {
amount: 90, amount: 90,
creationDate: 'YYYY-MM-01', creationDate: '2021-11-30',
email: 'bob@baumeister.de', email: 'bob@baumeister.de',
id: 0, id: 0,
memo: 'Test create coins', memo: 'Test create coins',
@ -233,7 +236,7 @@ describe('EditCreationFormular', () => {
expect.objectContaining({ expect.objectContaining({
variables: { variables: {
amount: 90, amount: 90,
creationDate: 'YYYY-MM-DD', creationDate: '2022-01-20',
email: 'bob@baumeister.de', email: 'bob@baumeister.de',
id: 0, id: 0,
memo: 'Test create coins', memo: 'Test create coins',

View File

@ -242,7 +242,7 @@ export default {
}, },
created() { created() {
if (this.creationUserData.date) { 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: case this.currentMonth.short:
this.createdIndex = 2 this.createdIndex = 2
this.radioSelected = this.currentMonth this.radioSelected = this.currentMonth