node-event-bot/tests/createdEvent.test.ts

31 lines
908 B
TypeScript
Raw Normal View History

2022-04-21 19:46:13 +02:00
import { getRepetitonInfo } from "../server/handler/repeatingEvents/helper"
describe('ScheduledEvent Creation Events', () => {
test('Daily Event with absolute end date', () => {
const eventObject = {
"id": "965576921410859018",
"guildId": "907936880190967850",
"channelId": "907936880190967854",
"creatorId": "191951058111692800",
"name": "Created event",
"description": "$rep:daily:2022-05-22",
"scheduledStartTimestamp": 1650294000782,
"scheduledEndTimestamp": null,
"privacyLevel": "GUILD_ONLY",
"status": "SCHEDULED",
"entityType": "VOICE",
"entityId": null,
"userCount": null,
"creator": null,
"entityMetadata": null
}
const rInfo = getRepetitonInfo(eventObject.description)
expect(rInfo).toBeDefined()
expect(rInfo.endDate).toBeDefined()
expect(rInfo.endDate).toEqual(new Date("2022-05-22"))
expect(rInfo.schedule).toEqual('daily')
})
})