fix(platform): harden queries and batch vehicle search

This commit is contained in:
lingniu
2026-07-16 00:14:16 +08:00
parent c29ccdf2da
commit 53e1b57e86
19 changed files with 193 additions and 53 deletions

View File

@@ -91,6 +91,20 @@ test('monitor viewport requests forward AbortSignal so obsolete pans can be canc
expect(fetchMock).toHaveBeenCalledWith('/api/v2/monitor/map?zoom=13&bounds=113%2C22%2C114%2C23', { signal: controller.signal });
});
test('high-volume history, track, and mileage requests forward AbortSignal', async () => {
const fetchMock = vi.spyOn(globalThis, 'fetch').mockResolvedValue({ ok: true, json: async () => ({ data: {} }) } as Response);
const controller = new AbortController();
const params = new URLSearchParams({ keyword: 'VIN001' });
await api.trackPlayback(params, controller.signal);
await api.historyData(params, controller.signal);
await api.historySeries(params, controller.signal);
await api.dailyMileage(params, controller.signal);
await api.mileageStatistics(params, controller.signal);
for (const [, init] of fetchMock.mock.calls) expect(init).toEqual({ signal: controller.signal });
});
test('rawFramesQuery posts structured JSON instead of URL query strings', async () => {
const fetchMock = vi.spyOn(globalThis, 'fetch').mockResolvedValue({
ok: true,