diff --git a/JobTrackerApi.Tests/ApplicationIntelligenceTests.cs b/JobTrackerApi.Tests/ApplicationIntelligenceTests.cs index 353153a..c43caf0 100644 --- a/JobTrackerApi.Tests/ApplicationIntelligenceTests.cs +++ b/JobTrackerApi.Tests/ApplicationIntelligenceTests.cs @@ -115,8 +115,11 @@ public sealed class ApplicationIntelligenceTests var (db, _, timeline) = New("user-1"); await using var _d = db; var job = await SeedJobAsync(db, "user-1"); - db.JobEvents.Add(new JobEvent { JobApplicationId = job.Id, Type = "Created", At = DateTime.Now.AddDays(-3) }); - db.JobEvents.Add(new JobEvent { JobApplicationId = job.Id, Type = "AiRefreshed", At = DateTime.Now.AddDays(-3).AddHours(2) }); + // Anchor the two older events to a fixed time-of-day so they always land on the same + // calendar day. Using DateTime.Now.AddDays(-3).AddHours(2) straddled midnight whenever the + // wall clock was within two hours of it, splitting one day into two and failing the test. + db.JobEvents.Add(new JobEvent { JobApplicationId = job.Id, Type = "Created", At = DateTime.Today.AddDays(-3).AddHours(9) }); + db.JobEvents.Add(new JobEvent { JobApplicationId = job.Id, Type = "AiRefreshed", At = DateTime.Today.AddDays(-3).AddHours(11) }); db.JobEvents.Add(new JobEvent { JobApplicationId = job.Id, Type = "ReplyReceived", At = DateTime.Now }); await db.SaveChangesAsync();