Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

Fix integration tests

Katos62a450f3760c
diff --git a/frontend/lib/datelib/datelib.test.ts b/frontend/lib/datelib/datelib.test.ts
index 171d2cc1..d2353bed 100644
--- a/frontend/lib/datelib/datelib.test.ts
+++ b/frontend/lib/datelib/datelib.test.ts
@@ -25,13 +25,19 @@ describe("zeroTime", () => {
describe("factorRange", () => {
test("should return a range of dates", () => {
const [start, end] = factorRange(10);
+
// Start should be today
expect(start).toBeInstanceOf(Date);
expect(start.getFullYear()).toBe(new Date().getFullYear());
// End should be 10 days from now
expect(end).toBeInstanceOf(Date);
- expect(end.getFullYear()).toBe(new Date().getFullYear());
+
+ // Set the future date so it works even in late December when the year changes
+ const futureDate = new Date();
+ futureDate.setDate(futureDate.getDate() + 10); // Adds 10 days to the current date
+
+ expect(end.getFullYear()).toBe(futureDate.getFullYear());
});
});