WIP: Plan tests
All checks were successful
Test / build (push) Successful in 30s

This commit is contained in:
Ethan Lane 2025-01-11 18:58:35 +00:00
parent 31cc9e056a
commit d794b30bb5
10 changed files with 204 additions and 176 deletions

View file

@ -0,0 +1,41 @@
describe("AddEffectToUserInventory", () => {
test.todo("GIVEN effect is found in database, EXPECT effect unused to be incremented");
test.todo("GIVEN effect is NOT found in database, EXPECT new effect to be created");
});
describe("UseEffect", () => {
test.todo("GIVEN user can not use effect, EXPECT false returned");
test.todo("GIVEN user has effect, EXPECT entity to be updated AND true returned");
});
describe("CanUseEffect", () => {
test.todo("GIVEN effect is not in database, EXPECT false returned");
test.todo("GIVEN user does not have any of the effect unused, EXPECT false returned");
test.todo("GIVEN effectDetail can not be found, EXPECT false returned");
test.todo("GIVEN effect has NOT passed the cooldown, EXPECT false returned");
test.todo("GIVEN effect has passed the cooldown, EXPECT true returned");
test.todo("GIVEN effect does not have a WhenExpires date supplied, EXPECT true returned");
});
describe("HasEffect", () => {
test.todo("GIVEN effect is NOT found in database, EXPECT false returned");
test.todo("GIVEN effect does NOT have an expiry date, EXPECT false returned");
test.todo("GIVEN effect.WhenExpires is in the future, EXPECT false returned");
test.todo("GIVEN effect.WhenExpires is in the past, EXPECT true returned");
});
describe("GenerateEffectEmbed", () => {
test.todo("GIVEN user has no effects, EXPECT embed to be generated");
test.todo("GIVEN user has some effects, EXPECT embed to be generated");
});

View file

@ -0,0 +1,38 @@
import TimeLengthInput from "../../src/helpers/TimeLengthInput";
describe("ConvertFromMilliseconds", () => {
test("EXPECT 1000ms to be outputted as a second", () => {
const timeLength = TimeLengthInput.ConvertFromMilliseconds(1000);
expect(timeLength.GetLengthShort()).toBe("1s");
});
test("EXPECT 60000ms to be outputted as a minute", () => {
const timeLength = TimeLengthInput.ConvertFromMilliseconds(60000);
expect(timeLength.GetLengthShort()).toBe("1m");
});
test("EXPECT 3600000ms to be outputted as an hour", () => {
const timeLength = TimeLengthInput.ConvertFromMilliseconds(3600000);
expect(timeLength.GetLengthShort()).toBe("1h");
});
test("EXPECT 86400000ms to be outputted as a day", () => {
const timeLength = TimeLengthInput.ConvertFromMilliseconds(86400000);
expect(timeLength.GetLengthShort()).toBe("1d");
});
test("EXPECT a combination to be outputted correctly", () => {
const timeLength = TimeLengthInput.ConvertFromMilliseconds(90061000);
expect(timeLength.GetLengthShort()).toBe("1d 1h 1m 1s");
});
test("EXPECT 0ms to be outputted as empty", () => {
const timeLength = TimeLengthInput.ConvertFromMilliseconds(0);
expect(timeLength.GetLengthShort()).toBe("");
});
test("EXPECT 123456789ms to be outputted correctly", () => {
const timeLength = TimeLengthInput.ConvertFromMilliseconds(123456789);
expect(timeLength.GetLengthShort()).toBe("1d 10h 17m 36s");
});
});