Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

fix(test): freeze the clock in ActivityForm.spec.tsx to stop a midnight flake

Khuram Niaz13c7780e8d91
diff --git a/__tests__/ActivityForm.spec.tsx b/__tests__/ActivityForm.spec.tsx
index 1a28692..1df8a15 100644
--- a/__tests__/ActivityForm.spec.tsx
+++ b/__tests__/ActivityForm.spec.tsx
@@ -49,7 +49,19 @@ document.createRange = () => {
return range;
};
-const user = userEvent.setup({ skipHover: true });
+const user = userEvent.setup({ skipHover: true, delay: null });
+
+// The form defaults to now/now+5min and the stepper buttons only shift the
+// clock, not the date, so a run within minutes of midnight would wrap the
+// end time across days and produce a negative duration
+beforeEach(() => {
+ vi.useFakeTimers({ shouldAdvanceTime: true });
+ vi.setSystemTime(new Date(2026, 7, 12, 9, 5, 30));
+});
+
+afterEach(() => {
+ vi.useRealTimers();
+});
async function renderForm() {
const onClose = vi.fn();