add date test (WIP)
This commit is contained in:
parent
c39f9c6ee1
commit
a6f19ccd2b
|
@ -0,0 +1,16 @@
|
||||||
|
import { GuildScheduledEvent } from "discord.js"
|
||||||
|
import { createDateStringFromEvent } from "../../server/helper/dateHelper"
|
||||||
|
import MockDate from 'mockdate'
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
MockDate.set('01-01-2023')
|
||||||
|
})
|
||||||
|
|
||||||
|
function getTestDate(date: string): GuildScheduledEvent {
|
||||||
|
return <GuildScheduledEvent>{ scheduledStartAt: new Date(date) }
|
||||||
|
}
|
||||||
|
test('createDateStringFromEvent - correct formatting', () => {
|
||||||
|
expect(createDateStringFromEvent(getTestDate('01-01-2023 12:30'), "")).toEqual('heute um 12:30')
|
||||||
|
expect(createDateStringFromEvent(getTestDate('01-02-2023 12:30'), "")).toEqual('am Montag 02.01. um 12:30')
|
||||||
|
expect(createDateStringFromEvent(getTestDate('01-03-2023 12:30'), "")).toEqual('am Dienstag 03.01 um 12:30')
|
||||||
|
})
|
Loading…
Reference in New Issue