From 3c45410932476a949c112529d53528137e73bc12 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sat, 21 Sep 2024 10:54:00 +0100 Subject: [PATCH 1/2] Update the moon description to use dash --- src/buttonEvents/moons/list.ts | 2 +- src/commands/304276391837302787/moons/add.ts | 2 +- src/commands/304276391837302787/moons/list.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/buttonEvents/moons/list.ts b/src/buttonEvents/moons/list.ts index ef7f7a9..36aa356 100644 --- a/src/buttonEvents/moons/list.ts +++ b/src/buttonEvents/moons/list.ts @@ -25,7 +25,7 @@ export default async function List(interaction: ButtonInteraction) { const totalPages = Math.ceil(moons[1] / pageLength); - const description = moons[0].flatMap(x => `${x.MoonNumber}. ${x.Description.slice(0, 15)}`); + const description = moons[0].flatMap(x => `**${x.MoonNumber} -** ${x.Description.slice(0, 15)}`); const embed = new EmbedBuilder() .setTitle(`${member?.user.username}'s Moons`) diff --git a/src/commands/304276391837302787/moons/add.ts b/src/commands/304276391837302787/moons/add.ts index a4459fc..130aee3 100644 --- a/src/commands/304276391837302787/moons/add.ts +++ b/src/commands/304276391837302787/moons/add.ts @@ -19,7 +19,7 @@ export default async function AddMoon(interaction: CommandInteraction) { const embed = new EmbedBuilder() .setTitle(`${interaction.user.globalName} Got A Moon!`) .setColor(EmbedColours.Moon) - .setDescription(`${moon.MoonNumber}. ${moon.Description}`) + .setDescription(`**${moon.MoonNumber} -** ${moon.Description}`) .setThumbnail("https://cdn.discordapp.com/emojis/374131312182689793.webp?size=96&quality=lossless"); await interaction.reply({ embeds: [ embed ] }); diff --git a/src/commands/304276391837302787/moons/list.ts b/src/commands/304276391837302787/moons/list.ts index ff4661e..838cd14 100644 --- a/src/commands/304276391837302787/moons/list.ts +++ b/src/commands/304276391837302787/moons/list.ts @@ -17,7 +17,7 @@ export default async function ListMoons(interaction: CommandInteraction) { const totalPages = Math.ceil(moons[1] / pageLength); - const description = moons[0].flatMap(x => `${x.MoonNumber}. ${x.Description.slice(0, 15)}`); + const description = moons[0].flatMap(x => `**${x.MoonNumber} -** ${x.Description.slice(0, 15)}`); const embed = new EmbedBuilder() .setTitle(`${user.username}'s Moons`) From a7b3079fcd134d39ce01c2ad1f502ce5cf5bb700 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sat, 21 Sep 2024 11:21:55 +0100 Subject: [PATCH 2/2] WIP: Start to plan tests --- tests/buttonEvents/moons/list.test.ts | 35 +++++++++++++++++ .../commands/304276391837302787/moons.test.ts | 17 ++++++++ .../304276391837302787/moons/add.test.ts | 17 ++++++++ .../304276391837302787/moons/list.test.ts | 39 +++++++++++++++++++ .../entities/304276391837302787/Moon.test.ts | 0 5 files changed, 108 insertions(+) create mode 100644 tests/buttonEvents/moons/list.test.ts create mode 100644 tests/commands/304276391837302787/moons.test.ts create mode 100644 tests/commands/304276391837302787/moons/add.test.ts create mode 100644 tests/commands/304276391837302787/moons/list.test.ts create mode 100644 tests/database/entities/304276391837302787/Moon.test.ts diff --git a/tests/buttonEvents/moons/list.test.ts b/tests/buttonEvents/moons/list.test.ts new file mode 100644 index 0000000..57cbb6d --- /dev/null +++ b/tests/buttonEvents/moons/list.test.ts @@ -0,0 +1,35 @@ +describe("GIVEN valid input", () => { + test.todo("EXPECT interaction.update to be called"); + + test.todo("EXPECT embed to contain correct information"); + + test.todo("EXPECT component row to contain correct information"); + + describe("GIVEN is first page", () => { + test.todo("EXPECT Previous button to be disabled"); + }); + + describe("GIVEN is last page", () => { + test.todo("EXPECT Next button to be disabled"); + }); +}); + +describe("GIVEN interaction.guild is undefined", () => { + test.todo("EXPECT nothing to happen"); +}); + +describe("GIVEN userId is not supplied", () => { + test.todo("EXPECT nothing to happen"); +}); + +describe("GIVEN page is not supplied", () => { + test.todo("EXPECT nothing to happen"); +}); + +describe("GIVEN moon object is undefined", () => { + test.todo("EXPECT error replied"); +}); + +describe("GIVEN the user has 0 moons", () => { + test.todo("EXPECT error replied"); +}); diff --git a/tests/commands/304276391837302787/moons.test.ts b/tests/commands/304276391837302787/moons.test.ts new file mode 100644 index 0000000..33d0978 --- /dev/null +++ b/tests/commands/304276391837302787/moons.test.ts @@ -0,0 +1,17 @@ +describe("constructor", () => { + test.todo("EXPECT CommandBuilder to be valid"); +}); + +describe("execute", () => { + describe("GIVEN subcommand is list", () => { + test.todo("EXPECT ListMoons executed"); + }); + + describe("GIVEN subcommand is add", () => { + test.todo("EXPECT AddMoon executed"); + }); + + describe("GIVEN interaction.isChatInputCommand is false", () => { + test.todo("EXPECT nothing to happen"); + }); +}); diff --git a/tests/commands/304276391837302787/moons/add.test.ts b/tests/commands/304276391837302787/moons/add.test.ts new file mode 100644 index 0000000..5491fcb --- /dev/null +++ b/tests/commands/304276391837302787/moons/add.test.ts @@ -0,0 +1,17 @@ +describe("GIVEN valid input", () => { + test.todo("EXPECT interaction replied"); + + test.todo("EXPECT embed details are correct"); +}); + +describe("GIVEN description is undefined", () => { + test.todo("EXPECT error replied"); + + test.todo("EXPECT function returned"); +}); + +describe("GIVEN description is more than 255 characters long", () => { + test.todo("EXPECT error replied"); + + test.todo("EXPECT function returned"); +}); diff --git a/tests/commands/304276391837302787/moons/list.test.ts b/tests/commands/304276391837302787/moons/list.test.ts new file mode 100644 index 0000000..9137203 --- /dev/null +++ b/tests/commands/304276391837302787/moons/list.test.ts @@ -0,0 +1,39 @@ +describe("GIVEN valid input", () => { + test.todo("EXPECT interaction replied"); + + test.todo("EXPECT embed information to be correct"); + + test.todo("EXPECT component information to be correct"); + + describe("GIVEN it is the first page", () => { + test.todo("EXPECT Previous button to be disabled"); + }); + + describe("GIVEN it is the last page", () => { + test.todo("EXPECT Next button to be disabled"); + }); +}); + +describe("GIVEN interaction.guild is undefined", () => { + test.todo("EXPECT nothing to happen"); +}); + +describe("GIVEN userId is not supplied", () => { + test.todo("EXPECT nothing to happen"); +}); + +describe("GIVEN page is not supplied", () => { + test.todo("EXPECT nothing to happen"); +}); + +describe("GIVEN moons object is undefined", () => { + test.todo("EXPECT error replied"); + + test.todo("EXPECT function returned"); +}); + +describe("GIVEN moons for user is 0", () => { + test.todo("EXPECT error replied"); + + test.todo("EXPECT function returned"); +}); diff --git a/tests/database/entities/304276391837302787/Moon.test.ts b/tests/database/entities/304276391837302787/Moon.test.ts new file mode 100644 index 0000000..e69de29