import { getRepetitonInfo } from "../server/handler/repeatingEvents/helper" describe('ScheduledEvent Creation Events', () => { test('Daily Event with absolute end date', () => { jest.mock('../server/helper/sendFailureDM.ts') 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) const expectedSchedule = { "_scheduleString": "daily", "baseScheduleTypes": ["daily", "weekly", "monthly", "yearly"], "duration": { "days": 1 }, "multiplier": 1, "scheduleName": "daily" } expect(rInfo).toBeDefined() expect(rInfo.endDate).toBeDefined() expect(rInfo.endDate).toEqual(new Date("2022-05-22")) expect(rInfo.schedule).toEqual(expectedSchedule) }) })