Unify retained operation history in Activity
This commit is contained in:
@@ -30,6 +30,20 @@ describe('Maintenance API', () => {
|
||||
}
|
||||
expect(await GET().json()).toEqual(before);
|
||||
});
|
||||
it('opens one retained request outside the recent history window without changing normal history', async () => {
|
||||
const { db } = await import('../../src/lib/server/db/index.js');
|
||||
const insert = db().prepare("INSERT INTO maintenance_jobs(server,state,requested_at,kind,origin) VALUES(?,'done',?,'schedule','schedule')");
|
||||
db().transaction(() => { for (let i = 0; i < 105; i++) insert.run('t5_zombie_theater_1', new Date(Date.UTC(2026, 0, 1, 0, i)).toISOString()); })();
|
||||
const { GET } = await import('../../src/routes/api/maintenance/+server.js');
|
||||
const ordinary = await GET().json();
|
||||
expect(ordinary.runtime.jobs).toHaveLength(100);
|
||||
expect(ordinary.runtime.jobs.some((job: { id: number }) => job.id === 1)).toBe(false);
|
||||
const selected = await GET({ url: new URL('http://localhost/api/maintenance?job=1') }).json();
|
||||
expect(selected.runtime.jobs).toHaveLength(101);
|
||||
expect(selected.runtime.jobs.find((job: { id: number }) => job.id === 1)).toMatchObject({ state: 'done', kind: 'schedule' });
|
||||
for (const job of ['0', '-1', '', '1.5', 'bad', '99999999999999999999']) expect(GET({ url: new URL(`http://localhost/api/maintenance?job=${job}`) }).status).toBe(400);
|
||||
expect(await GET().json()).toEqual(ordinary);
|
||||
});
|
||||
it('keeps old Watchdog URLs working through query-preserving redirects', async () => {
|
||||
const index = await import('../../src/routes/watchdog/+page.server.js');
|
||||
const detail = await import('../../src/routes/watchdog/[id]/+page.server.js');
|
||||
|
||||
Reference in New Issue
Block a user