mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 07:13:12 +00:00
test(workorders): pin the week-only date range rule shared with the board page (SH-391)
This commit is contained in:
parent
028908bd5a
commit
9d5798437d
1 changed files with 13 additions and 2 deletions
|
|
@ -49,6 +49,12 @@ public class WorkOrderAdvancedSearchDateRangeTests
|
|||
istemplate = false
|
||||
};
|
||||
|
||||
private static WorkOrder NotWeekOnly(WorkOrder wo)
|
||||
{
|
||||
wo.ScheduleWeekOnly = false;
|
||||
return wo;
|
||||
}
|
||||
|
||||
private static WorkOrderAdvancedSearchQueryDto UnassignedInRange(bool includeDateless = false) => new()
|
||||
{
|
||||
DatePreset = WorkOrderAdvancedSearchDatePreset.Custom,
|
||||
|
|
@ -105,7 +111,12 @@ public class WorkOrderAdvancedSearchDateRangeTests
|
|||
context.workOrders.AddRange(
|
||||
Wo(1, null, targetWeek: new DateOnly(2026, 9, 21)),
|
||||
Wo(2, null, targetWeek: new DateOnly(2026, 9, 14)),
|
||||
Wo(3, null, targetWeek: new DateOnly(2026, 9, 28)));
|
||||
Wo(3, null, targetWeek: new DateOnly(2026, 9, 28)),
|
||||
// Week-only with a leftover date outside the range: the week decides,
|
||||
// as on the board page (SH-391).
|
||||
Wo(4, new DateTime(2026, 10, 2), targetWeek: new DateOnly(2026, 9, 21)),
|
||||
// Not week-only: its date decides, so a target week does not bring it in.
|
||||
NotWeekOnly(Wo(5, new DateTime(2026, 10, 2), targetWeek: new DateOnly(2026, 9, 21))));
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
// Wed–Fri of the week of 9/21: the week-only row for that week overlaps it.
|
||||
|
|
@ -117,7 +128,7 @@ public class WorkOrderAdvancedSearchDateRangeTests
|
|||
Dispatchers = new List<string> { "__unassigned__" }
|
||||
}, WorkOrderAccountTestHelpers.OrgWideAdmin(), null);
|
||||
|
||||
Assert.Equal(new[] { 1 }, result.Items.Select(i => i.Id).ToArray());
|
||||
Assert.Equal(new[] { 1, 4 }, result.Items.Select(i => i.Id).OrderBy(id => id).ToArray());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue