mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-10-04 07:52:13 +00:00
test(work-orders): cover date-only dispatch apptTime mapping
This commit is contained in:
parent
e45e71d5ac
commit
a6b3d5d073
1 changed files with 89 additions and 0 deletions
|
|
@ -869,4 +869,93 @@ public class WorkOrderBoardServiceTests
|
||||||
null,
|
null,
|
||||||
cts.Token));
|
cts.Token));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void MapRawRow_DateOnlyDispatch_KeepsApptDate_LeavesApptTimeNull()
|
||||||
|
{
|
||||||
|
var dispatchApptDate = new DateTime(2026, 6, 25);
|
||||||
|
var row = RawRow(
|
||||||
|
scheduledDate: new DateTime(2026, 6, 23),
|
||||||
|
scheduledStart: null,
|
||||||
|
scheduledEnd: null,
|
||||||
|
dispatchApptDate: dispatchApptDate);
|
||||||
|
|
||||||
|
var dto = WorkOrderBoardService.MapRawRow(row, DateTime.UtcNow);
|
||||||
|
|
||||||
|
Assert.Equal(dispatchApptDate, dto.ApptDate);
|
||||||
|
Assert.Null(dto.ApptTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void MapRawRow_DispatchWithClock_FallsBackToDispatchTime()
|
||||||
|
{
|
||||||
|
var dispatchApptDate = new DateTime(2026, 6, 25, 9, 0, 0);
|
||||||
|
var row = RawRow(
|
||||||
|
scheduledDate: new DateTime(2026, 6, 23),
|
||||||
|
scheduledStart: null,
|
||||||
|
scheduledEnd: null,
|
||||||
|
dispatchApptDate: dispatchApptDate);
|
||||||
|
|
||||||
|
var dto = WorkOrderBoardService.MapRawRow(row, DateTime.UtcNow);
|
||||||
|
|
||||||
|
Assert.Equal(dispatchApptDate, dto.ApptDate);
|
||||||
|
Assert.Equal("09:00", dto.ApptTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static WorkOrderBoardRawRow RawRow(
|
||||||
|
DateTime? scheduledDate,
|
||||||
|
DateTime? scheduledStart,
|
||||||
|
DateTime? scheduledEnd,
|
||||||
|
DateTime? dispatchApptDate)
|
||||||
|
=> new(
|
||||||
|
Id: 1,
|
||||||
|
InternalWONumber: "10000000001",
|
||||||
|
RescheduleCount: 0,
|
||||||
|
CarriedOver: 0,
|
||||||
|
IsAddOn: false,
|
||||||
|
WorkOrderType: null,
|
||||||
|
SiteCode: null,
|
||||||
|
LocationName: null,
|
||||||
|
PocName: null,
|
||||||
|
PocPhone: null,
|
||||||
|
PocNotes: null,
|
||||||
|
LifecycleStatus: LifecycleStatus.Scheduled,
|
||||||
|
LegacyStatus: null,
|
||||||
|
AssignTo: null,
|
||||||
|
DispatcherFirstName: null,
|
||||||
|
DispatcherLastName: null,
|
||||||
|
Initials: null,
|
||||||
|
Color: null,
|
||||||
|
DueDate: null,
|
||||||
|
ScheduledDate: scheduledDate,
|
||||||
|
ScheduledStart: scheduledStart,
|
||||||
|
ScheduledEnd: scheduledEnd,
|
||||||
|
TargetWeek: null,
|
||||||
|
ScheduleWeekOnly: null,
|
||||||
|
VendorId: null,
|
||||||
|
VendorName: null,
|
||||||
|
TechName: null,
|
||||||
|
TechPhone: null,
|
||||||
|
DispatchApptDate: dispatchApptDate,
|
||||||
|
Trade: null,
|
||||||
|
Problem: null,
|
||||||
|
ServiceNotes: null,
|
||||||
|
ExtraServices: null,
|
||||||
|
AdditionalContacts: null,
|
||||||
|
DocStatus: null,
|
||||||
|
CompletedDate: null,
|
||||||
|
FlagColor: null,
|
||||||
|
PrimaryDispatchId: 10,
|
||||||
|
RowVersion: null,
|
||||||
|
DispatchRowVersion: null,
|
||||||
|
PendingUpliftCount: 0,
|
||||||
|
HasUplift: false,
|
||||||
|
PrimaryUpliftStatus: null,
|
||||||
|
PrimaryUpliftAmount: null,
|
||||||
|
PrimaryDispatchStatus: null,
|
||||||
|
AvetaRequired: false,
|
||||||
|
HasAvetaDocument: false,
|
||||||
|
OriginalDate: null,
|
||||||
|
OriginalWeek: null,
|
||||||
|
IsUnscheduled: false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue