Improve application responsiveness and background processing
This commit is contained in:
@@ -150,16 +150,16 @@ describe('historical metrics', () => {
|
||||
vi.spyOn(Date, 'now').mockReturnValue(at + 30_000);
|
||||
for (const range of ['1', '7', '30', 'invalid', '365', '-1', '']) {
|
||||
const url = new URL(`http://localhost/metrics?days=${range}`);
|
||||
const response = GET({ url });
|
||||
const response = await GET({ url });
|
||||
const payload = await response.json();
|
||||
expect(response.headers.get('cache-control')).toBe('no-store');
|
||||
expect(payload).toEqual(await load({ url } as Parameters<typeof load>[0]));
|
||||
expect(payload.days).toBe(['1', '7', '30'].includes(range) ? Number(range) : 7);
|
||||
}
|
||||
expect((await GET({ url: new URL('http://localhost/api/metrics') }).json()).days).toBe(7);
|
||||
expect((await (await GET({ url: new URL('http://localhost/api/metrics') })).json()).days).toBe(7);
|
||||
for (const search of ['days=1&game=t5&map=Moon&timeZone=Asia%2FKathmandu', 'days=7&map=Moon', 'game=t6&timeZone=Invalid']) {
|
||||
const url = new URL(`http://localhost/metrics?${search}`);
|
||||
const payload = await GET({ url }).json();
|
||||
const payload = await (await GET({ url })).json();
|
||||
const { days, ...scope } = parseMetricsQuery(url.searchParams);
|
||||
expect(payload).toEqual(await load({ url } as Parameters<typeof load>[0]));
|
||||
expect(payload).toMatchObject({ days, scope });
|
||||
|
||||
Reference in New Issue
Block a user