diff --git a/src/buttonEvents/Effects.ts b/src/buttonEvents/Effects.ts index cd1a765..0f9686b 100644 --- a/src/buttonEvents/Effects.ts +++ b/src/buttonEvents/Effects.ts @@ -3,7 +3,6 @@ import { ButtonEvent } from "../type/buttonEvent"; import List from "./Effects/List"; import Use from "./Effects/Use"; import AppLogger from "../client/appLogger"; -import Buy from "./Effects/Buy"; export default class Effects extends ButtonEvent { public override async execute(interaction: ButtonInteraction) { @@ -16,9 +15,6 @@ export default class Effects extends ButtonEvent { case "use": await Use.Execute(interaction); break; - case "buy": - await Buy.Execute(interaction); - break; default: AppLogger.LogError("Buttons/Effects", `Unknown action, ${action}`); } diff --git a/src/buttonEvents/Effects/Buy.ts b/src/buttonEvents/Effects/Buy.ts deleted file mode 100644 index a7fc2c4..0000000 --- a/src/buttonEvents/Effects/Buy.ts +++ /dev/null @@ -1,25 +0,0 @@ -import {ButtonInteraction} from "discord.js"; -import AppLogger from "../../client/appLogger"; - -export default class Buy { - public static async Execute(interaction: ButtonInteraction) { - const subaction = interaction.customId.split(" ")[2]; - - switch (subaction) { - case "confirm": - await this.Confirm(interaction); - break; - case "cancel": - await this.Cancel(interaction); - break; - default: - AppLogger.LogError("Buy", `Unknown subaction, effects ${subaction}`); - } - } - - private static async Confirm(interaction: ButtonInteraction) { - } - - private static async Cancel(interaction: ButtonInteraction) { - } -} diff --git a/src/commands/effects/Buy.ts b/src/commands/effects/Buy.ts index 3ebf587..e26b585 100644 --- a/src/commands/effects/Buy.ts +++ b/src/commands/effects/Buy.ts @@ -1,22 +1,4 @@ import { CommandInteraction } from "discord.js"; -import EffectHelper from "../../helpers/EffectHelper"; export default async function Buy(interaction: CommandInteraction) { - const id = interaction.options.get("id", true).value!; - const quantity = interaction.options.get("quantity")?.value ?? 1; - - const idValue = id.toString(); - const quantityValue = Number(quantity); - - const result = await EffectHelper.GenerateEffectBuyEmbed(interaction.user.id, idValue, quantityValue, false); - - if (typeof result == "string") { - await interaction.reply(result); - return; - } - - await interaction.reply({ - embeds: [ result.embed ], - components: [ result.row ], - }); } \ No newline at end of file diff --git a/tests/buttonEvents/Effects.test.ts b/tests/buttonEvents/Effects.test.ts index 8fb1023..f1f86be 100644 --- a/tests/buttonEvents/Effects.test.ts +++ b/tests/buttonEvents/Effects.test.ts @@ -49,8 +49,6 @@ test("GIVEN action is use, EXPECT use function to be called", async () => { expect(List).not.toHaveBeenCalled(); }); -test.todo("GIVEN action is buy, EXPECT buy function to be called"); - test("GIVEN action is invalid, EXPECT nothing to be called", async () => { // Arrange interaction.customId = "effects invalid"; @@ -65,4 +63,4 @@ test("GIVEN action is invalid, EXPECT nothing to be called", async () => { expect(AppLogger.LogError).toHaveBeenCalledTimes(1); expect(AppLogger.LogError).toHaveBeenCalledWith("Buttons/Effects", "Unknown action, invalid"); -}); +}); \ No newline at end of file diff --git a/tests/buttonEvents/Effects/Buy.test.ts b/tests/buttonEvents/Effects/Buy.test.ts deleted file mode 100644 index f094e0c..0000000 --- a/tests/buttonEvents/Effects/Buy.test.ts +++ /dev/null @@ -1,7 +0,0 @@ -describe("Execute", () => { - test.todo("GIVEN subaction is confirm, EXPECT confirm function executed"); - - test.todo("GIVEN subaction is cancel, EXPECT cancel function executed"); - - test.todo("GIVEN subaction is invalid, EXPECT error logged"); -}); diff --git a/tests/commands/effects/Buy.test.ts b/tests/commands/effects/Buy.test.ts deleted file mode 100644 index 8ae5cf3..0000000 --- a/tests/commands/effects/Buy.test.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Buy from "../../../src/commands/effects/Buy"; -import EffectHelper from "../../../src/helpers/EffectHelper"; - -jest.mock("../../../src/helpers/EffectHelper"); - -describe("Buy", () => { - test.todo("GIVEN result returns a string, EXPECT interaction replied with string"); - - test.todo("GIVEN result returns an embed, EXPECT interaction replied with embed and row"); - - test.todo("GIVEN quantity option is not supplied, EXPECT quantity to default to 1"); -});