WIP: Split up moon counter from the database #489
5 changed files with 91 additions and 42 deletions
|
@ -24,11 +24,7 @@ export default async function AddMoon(interaction: CommandInteraction) {
|
||||||
|
|
||||||
const allMoons = await Moon.FetchMoonCountByUserId(interaction.user.id);
|
const allMoons = await Moon.FetchMoonCountByUserId(interaction.user.id);
|
||||||
|
|
||||||
let moonNumber = allMoons + 1;
|
const moonNumber = allMoons + 1;
|
||||||
|
|
||||||
if (allMoons < moonCount) {
|
|
||||||
moonNumber = moonCount + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
const moon = new Moon(moonNumber, description, interaction.user.id);
|
const moon = new Moon(moonNumber, description, interaction.user.id);
|
||||||
|
|
||||||
|
|
|
@ -1,49 +1,43 @@
|
||||||
describe("GIVEN interation.guild is null", () => {
|
describe("GIVEN interaction.guild is null", () => {
|
||||||
test.todo("EXPECT nothing to happen");
|
test.todo("EXPECT function to return");
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("GIVEN userId is not supplied", () => {
|
describe("GIVEN userId parameter is undefined", () => {
|
||||||
test.todo("EXPECT nothing to happen");
|
test.todo("EXPECT function to return");
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("GIVEN page is not supplied", () => {
|
describe("GIVEN page parameter is undefined", () => {
|
||||||
test.todo("EXPECT nothing to happen");
|
test.todo("EXPECT function to return");
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("GIVEN moons entity is undefined", () => {
|
describe("GIVEN no moons for the user is returned", () => {
|
||||||
test.todo("EXPECT interaction replied");
|
test.todo("EXPECT error replied");
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("GIVEN moons array is empty", () => {
|
describe("GIVEN no moons on current page", () => {
|
||||||
test.todo("EXPECT embed description to say none");
|
test.todo("EXPECT description to say so");
|
||||||
});
|
|
||||||
|
|
||||||
describe("GIVEN moons array is not empty", () => {
|
|
||||||
test.todo("EXPECT embed description to specify moon details");
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("GIVEN moon difference is greater than 0", () => {
|
|
||||||
describe("GIVEN it is not the last page", () => {
|
|
||||||
test.todo("EXPECT untracked moons message to not be displayed");
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("GIVEN it is the last page", () => {
|
|
||||||
test.todo("EXPECT untracked moons to be displayed");
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("GIVEN moons array is empty", () => {
|
|
||||||
test.todo("EXPECT untracked moons to be displayed");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
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 happy flow", () => {
|
describe("GIVEN happy flow", () => {
|
||||||
test.todo("EXPECT interaction to be updated");
|
test.todo("EXPECT moons to be fetched");
|
||||||
|
|
||||||
|
test.todo("EXPECT embed to be updated");
|
||||||
|
|
||||||
|
test.todo("EXPECT row to be updated");
|
||||||
|
|
||||||
|
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 there are more moons in the counter than in the database", () => {
|
||||||
|
test.todo("EXPECT untracked counter to be present");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("GIVEN no moons on the current page", () => {
|
||||||
|
test.todo("EXPECT Next button to be disabled");
|
||||||
|
});
|
||||||
});
|
});
|
19
tests/commands/304276391837302787/moons/add.test.ts
Normal file
19
tests/commands/304276391837302787/moons/add.test.ts
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
describe("GIVEN description is null", () => {
|
||||||
|
test.todo("EXPECT error replied");
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("GIVEN description is greater than 255 characters", () => {
|
||||||
|
test.todo("EXPECT error replied");
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("GIVEN moon count setting exists", () => {
|
||||||
|
test.todo("EXPECT existing entity to be updated");
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("GIVEN moon count setting does not exist", () => {
|
||||||
|
test.todo("EXPECT new entity to be created");
|
||||||
|
});
|
||||||
|
|
||||||
|
test.todo("EXPECT setting to be saved");
|
||||||
|
|
||||||
|
test.todo("EXPECT embed to be replied");
|
29
tests/commands/304276391837302787/moons/list.test.ts
Normal file
29
tests/commands/304276391837302787/moons/list.test.ts
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
describe("GIVEN moons returned is empty", () => {
|
||||||
|
test.todo("EXPECT none description");
|
||||||
|
});
|
||||||
|
|
||||||
|
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 moon count is greater than the amount of moons in the database", () => {
|
||||||
|
test.todo("EXPECT untracked counter to be shown");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("GIVEN moon count is empty", () => {
|
||||||
|
test.todo("EXPECT Next button to be disabled");
|
||||||
|
|
||||||
|
describe("GIVEN moon count is greater than the amount of moons in the database", () => {
|
||||||
|
test.todo("EXPECT untracked counter to be shown");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test.todo("EXPECT interaction to be replied");
|
||||||
|
|
||||||
|
test.todo("EXPECT embed to be replied");
|
||||||
|
|
||||||
|
test.todo("EXPECT row to be replied");
|
11
tests/database/entites/UserSetting.test.ts
Normal file
11
tests/database/entites/UserSetting.test.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
describe("constructor", () => {
|
||||||
|
test.todo("EXPECT settings to be configured");
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("UpdateValue", () => {
|
||||||
|
test.todo("EXPECT value to be updated");
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("FetchOneByKey", () => {
|
||||||
|
test.todo("EXPECT single entity returned");
|
||||||
|
});
|
Loading…
Reference in a new issue