Skip to content

Commit eab6014

Browse files
renemadsenclaude
andcommitted
test: seed AssignedSite rows for partial-shift handover tests
AcceptAsync hard-fails on the partial path when no AssignedSite exists for source/target (safety net against silent derived-field corruption). The new partial-shift tests did not seed these rows, so CI failed with "AssignedSite missing for source worker". Seed both sites in the shared SeedPartialShiftPairAsync helper. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 404a5e6 commit eab6014

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

eFormAPI/Plugins/TimePlanning.Pn/TimePlanning.Pn.Test/ContentHandoverServiceTests.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,19 @@ public async Task GetMineAsync_ReturnsRequestsFromSender()
496496

497497
private async Task<(PlanRegistration source, PlanRegistration target)> SeedPartialShiftPairAsync(DateTime date)
498498
{
499+
// Accept path recomputes derived fields via PlanRegistrationHelper, which
500+
// requires an AssignedSite row per SdkSitId. Seed both before the plan rows.
501+
if (!await TimePlanningPnDbContext.AssignedSites.AnyAsync(a => a.SiteId == 1))
502+
{
503+
await new AssignedSite { SiteId = 1, CreatedByUserId = 1, UpdatedByUserId = 1 }
504+
.Create(TimePlanningPnDbContext);
505+
}
506+
if (!await TimePlanningPnDbContext.AssignedSites.AnyAsync(a => a.SiteId == 2))
507+
{
508+
await new AssignedSite { SiteId = 2, CreatedByUserId = 1, UpdatedByUserId = 1 }
509+
.Create(TimePlanningPnDbContext);
510+
}
511+
499512
var source = new PlanRegistration
500513
{
501514
Date = date,

0 commit comments

Comments
 (0)