Enable first operating day with staff assignments, opening guide, and ledger
This commit is contained in:
@@ -608,6 +608,7 @@ func _test_payroll_snapshot_migration_and_tamper() -> void:
|
||||
legacy_source.remove_staff(&"departed_debt", &"LEFT", true, 0)
|
||||
var legacy: Dictionary = legacy_source.create_snapshot()
|
||||
legacy[&"version"] = 1
|
||||
legacy.erase(&"work_assignments")
|
||||
legacy.erase(&"last_advanced_minute")
|
||||
legacy.erase(&"payroll_settlements")
|
||||
for staff_snapshot: Dictionary in legacy[&"staff"]:
|
||||
@@ -621,7 +622,7 @@ func _test_payroll_snapshot_migration_and_tamper() -> void:
|
||||
"v1 migration preserves active and departed unpaid wages"
|
||||
)
|
||||
var migrated_snapshot := migrated.create_snapshot()
|
||||
_expect(migrated_snapshot[&"version"] == 3 and migrated_snapshot[&"payroll_settlements"].is_empty(), "v1 migration emits canonical v3 with empty history")
|
||||
_expect(migrated_snapshot[&"version"] == StaffServiceType.SNAPSHOT_VERSION and migrated_snapshot[&"payroll_settlements"].is_empty(), "v1 migration emits canonical current schema with empty history")
|
||||
|
||||
var service := StaffServiceType.new()
|
||||
service.register_staff(_staff(&"staff_a", 10, {&"daily_wage": 100, &"unpaid_wages": 20}))
|
||||
@@ -630,19 +631,20 @@ func _test_payroll_snapshot_migration_and_tamper() -> void:
|
||||
service.apply_daily_payroll_settlement(&"snapshot.day.2", 2, {&"staff_a": 50, &"staff_b": 100})
|
||||
var snapshot: Dictionary = service.create_snapshot()
|
||||
var restored := StaffServiceType.new()
|
||||
_expect(restored.restore_snapshot(snapshot), "canonical v3 payroll history restores")
|
||||
_expect(restored.create_snapshot() == snapshot, "v3 payroll settlement history round trip is exact")
|
||||
_expect(restored.restore_snapshot(snapshot), "canonical current schema payroll history restores")
|
||||
_expect(restored.create_snapshot() == snapshot, "current payroll settlement history round trip is exact")
|
||||
var v2_snapshot: Dictionary = snapshot.duplicate(true)
|
||||
v2_snapshot[&"version"] = 2
|
||||
v2_snapshot.erase(&"work_assignments")
|
||||
for staff_snapshot: Dictionary in v2_snapshot[&"staff"]:
|
||||
staff_snapshot.erase(&"snapshot_version")
|
||||
staff_snapshot.erase(&"employment_effective_minute")
|
||||
var v2_migrated := StaffServiceType.new()
|
||||
_expect(v2_migrated.restore_snapshot(v2_snapshot), "pre-effective-minute v2 payroll history migrates")
|
||||
_expect(
|
||||
v2_migrated.create_snapshot()[&"version"] == 3
|
||||
v2_migrated.create_snapshot()[&"version"] == StaffServiceType.SNAPSHOT_VERSION
|
||||
and v2_migrated.get_staff(&"staff_a").employment_effective_minute == 0,
|
||||
"v2 migration emits canonical v3 Staff rows at effective minute zero"
|
||||
"v2 migration emits canonical current schema Staff rows at effective minute zero"
|
||||
)
|
||||
var before_tamper := restored.create_snapshot()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user