This commit is contained in:
kenobi 2023-07-13 22:46:03 +02:00
parent ca19168cf4
commit 878c81bfa7

View File

@ -1,4 +1,3 @@
import { GuildScheduledEvent } from "discord.js"
import { createDateStringFromEvent } from "../../server/helper/dateHelper" import { createDateStringFromEvent } from "../../server/helper/dateHelper"
import MockDate from 'mockdate' import MockDate from 'mockdate'
@ -6,8 +5,8 @@ beforeAll(() => {
MockDate.set('01-01-2023') MockDate.set('01-01-2023')
}) })
function getTestDate(date: string): GuildScheduledEvent { function getTestDate(date: string): Date {
return <GuildScheduledEvent>{ scheduledStartAt: new Date(date) } return new Date(date)
} }
test('createDateStringFromEvent - correct formatting', () => { test('createDateStringFromEvent - correct formatting', () => {
expect(createDateStringFromEvent(getTestDate('01-01-2023 12:30'), "")).toEqual('heute um 12:30') expect(createDateStringFromEvent(getTestDate('01-01-2023 12:30'), "")).toEqual('heute um 12:30')