perf(monitor): aggregate realtime workspace
This commit is contained in:
@@ -291,6 +291,26 @@ func TestMonitorMapTenThousandVehiclesNeverReturnsTenThousandPoints(t *testing.T
|
||||
}
|
||||
}
|
||||
|
||||
func TestMonitorWorkspaceSharesOneRealtimeSnapshot(t *testing.T) {
|
||||
store := newCountingStore()
|
||||
service := NewService(store)
|
||||
workspace, err := service.MonitorWorkspace(context.Background(), url.Values{
|
||||
"zoom": {"13"}, "railLimit": {"2"},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("MonitorWorkspace returned error: %v", err)
|
||||
}
|
||||
if store.vehicleRealtimeCalls != 1 {
|
||||
t.Fatalf("workspace should read one realtime snapshot, calls=%d", store.vehicleRealtimeCalls)
|
||||
}
|
||||
if workspace.Summary.TotalVehicles == 0 || workspace.Map.Total == 0 {
|
||||
t.Fatalf("workspace should derive summary and map from the shared snapshot: %+v", workspace)
|
||||
}
|
||||
if len(workspace.Vehicles.Items) != 2 || workspace.Vehicles.Limit != 2 || workspace.Vehicles.Total < 2 {
|
||||
t.Fatalf("workspace rail page should honor its bounded limit: %+v", workspace.Vehicles)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMonitorMapUsesMeaningfulClustersAndReleasesPointsAtDetailZoom(t *testing.T) {
|
||||
vehicles := Page[VehicleRealtimeRow]{Items: []VehicleRealtimeRow{
|
||||
{VIN: "NEAR-1", Plate: "粤A00001", Online: true, Longitude: 113.260, Latitude: 23.130},
|
||||
|
||||
Reference in New Issue
Block a user