Remove standalone Activity log page (Refs #153)
This commit is contained in:
+11
-15
@@ -475,7 +475,7 @@ describe('unified retained Activity', () => {
|
||||
expect(api.activityHistory({ source: 'campaign' }).total).toBe(1);
|
||||
});
|
||||
|
||||
it('uses the same query contract for API and page loaders with no-store API responses', async () => {
|
||||
it('keeps the shared history query contract and no-store API responses', async () => {
|
||||
const api = await setup();
|
||||
api.operation('a');
|
||||
api.operation('b', { state: 'failed' });
|
||||
@@ -483,23 +483,19 @@ describe('unified retained Activity', () => {
|
||||
api.maintenance(1, 'failed');
|
||||
api.incident('finding', 'health', 'attention');
|
||||
const url = new URL(
|
||||
'http://localhost/activity?state=failed&limit=1&excludeProvisioning=true&excludeMaintenance=true'
|
||||
'http://localhost/api/activity?state=failed&limit=1&excludeProvisioning=true&excludeMaintenance=true'
|
||||
);
|
||||
const { GET } = await import('../../src/routes/api/activity/+server.js');
|
||||
const { load } = await import('../../src/routes/activity/+page.server.js');
|
||||
const response = GET({ url });
|
||||
expect(response.headers.get('cache-control')).toBe('no-store');
|
||||
expect(await response.json()).toEqual(JSON.parse(JSON.stringify(load({ url }).activity)));
|
||||
expect(load({ url }).activity.rows[0].id).toBe('host:failed-check');
|
||||
expect(
|
||||
load({
|
||||
url: new URL('http://localhost/activity?excludeProvisioning=false')
|
||||
}).activity.rows.some((row) => row.id.startsWith('provisioning:'))
|
||||
).toBe(false);
|
||||
expect(
|
||||
load({
|
||||
url: new URL('http://localhost/activity?excludeMaintenance=false')
|
||||
}).activity.rows.map((row) => row.id)
|
||||
).toEqual(['host:failed-check']);
|
||||
const body = await response.json();
|
||||
expect(body).toEqual(
|
||||
JSON.parse(JSON.stringify(api.activityHistory(parseActivityQuery(url.searchParams))))
|
||||
);
|
||||
expect(body.rows[0].id).toBe('host:failed-check');
|
||||
const history = await GET({ url: new URL('http://localhost/api/activity') }).json();
|
||||
expect(history.rows.map((row: { id: string }) => row.id)).toEqual(
|
||||
expect.arrayContaining(['provisioning:a', 'provisioning:b', 'host:failed-check'])
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user