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', () => {
|
2022-05-05 21:39:10 +02:00
|
|
|
jest.mock('../server/helper/sendFailureDM.ts')
|
2022-04-21 19:46:13 +02:00
|
|
|
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)
|
2022-05-05 21:39:10 +02:00
|
|
|
const expectedSchedule = { "_scheduleString": "daily", "baseScheduleTypes": ["daily", "weekly", "monthly", "yearly"], "duration": { "days": 1 }, "multiplier": 1, "scheduleName": "daily" }
|
2022-04-21 19:46:13 +02:00
|
|
|
expect(rInfo).toBeDefined()
|
|
|
|
expect(rInfo.endDate).toBeDefined()
|
|
|
|
expect(rInfo.endDate).toEqual(new Date("2022-05-22"))
|
2022-05-05 21:39:10 +02:00
|
|
|
expect(rInfo.schedule).toEqual(expectedSchedule)
|
2022-04-21 19:46:13 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
})
|