Skip to content

Commit

Permalink
fix(minor updates #13): Unit tests update and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DasithKuruppu committed Oct 19, 2022
1 parent 08551a5 commit 3c7e220
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
1 change: 1 addition & 0 deletions bot/interactions/commands/create/raid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const createRaidCommand = async (

const isFivePerson = isFivePersonDungeon(title);
const requestedDate = convertToDiscordDate(dateTime);
logger.log("info", "create attributes", {isFivePerson, requestedDate, dateTime});
const partyOptionsToMap = {
Standard: { DPS: 6, HEALS: 2, TANKS: 2, WAITLIST: 3 },
Solo_tank: { DPS: 7, HEALS: 2, TANKS: 1, WAITLIST: 3 },
Expand Down
2 changes: 1 addition & 1 deletion bot/interactions/commands/request/inviteLink.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import dayjs from "dayjs";
import dayjs from "dayjs-parser/dayjs";
import {
APIChatInputApplicationCommandInteractionData,
APIApplicationCommandInteractionDataRoleOption,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import dayjs from "dayjs-parser/dayjs";
import dayjs from "dayjs";
import dayjsParser from "dayjs-parser";

dayjs.extend(dayjsParser);

export const convertToDiscordDate = (date: string, { long = true, relative = false } = {}) => {
const dateConvertible = dayjs(date).unix();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("User Actions - executeEmbedFieldActions", () => {
vi.resetModules();
});

test("Should provide a proper discord long timestamp", () => {
test.only("Should provide a proper discord long timestamp", () => {
const dateResult = convertToDiscordDate('2022-09-25T11:31:00+05:30');
expect(dateResult).toBe(`<t:1664085660:F>`);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,34 @@ describe.only("Raid - determineRaidTemplateType", () => {
{ name: "Wizard(DPS)", value: `<@randomnameone>`, inline: true },
],
});
expect(result).toEqual({});
expect(result).toEqual({
templateId: "1U2U0U0U0U0U0U0",
templateMetaInfo: {
[Category.DPS_TITLE]: {
count: 1,
},
[Category.DPS]: {
count: 2,
},
[Category.HEALER_TITLE]: {
count: 0,
},
[Category.HEALER]: {
count: 0,
},
[Category.TANK_TITLE]: {
count: 0,
},
[Category.TANK]: {
count: 0,
},
[Category.WAITLIST_TITLE]: {
count: 0,
},
[Category.WAITLIST]: {
count: 0,
},
},
});
});
});

0 comments on commit 3c7e220

Please sign in to comment.