diff --git a/test/routes/system-routes.test.ts b/test/routes/system-routes.test.ts index 6087e7c4..0cd44d47 100644 --- a/test/routes/system-routes.test.ts +++ b/test/routes/system-routes.test.ts @@ -696,6 +696,31 @@ describe('system-routes', () => { warn.mockRestore(); } }); + + // One request per route on the fresh per-test harness, so each warn call is pinned on its own + // (the once-flag would let the first route's warning mask a missing call on the others). + it.each([ + { label: 'GET /api/screenshots', method: 'GET' as const, url: '/api/screenshots' }, + { + label: 'POST /api/screenshots', + method: 'POST' as const, + url: '/api/screenshots', + payload: { file: 'data' }, + headers: { 'content-type': 'application/json' }, + }, + { label: 'GET /api/screenshots/:name', method: 'GET' as const, url: '/api/screenshots/nonexistent.png' }, + ])('$label warns that it is deprecated', async ({ method, url, payload, headers }) => { + const warn = vi.spyOn(console, 'warn').mockImplementation(() => {}); + try { + mockedExistsSync.mockReturnValue(false); + await harness.app.inject({ method, url, payload, headers }); + const deprecations = warn.mock.calls.filter((c) => String(c[0]).includes('/api/screenshots')); + expect(deprecations).toHaveLength(1); + expect(String(deprecations[0][0])).toContain('POST /api/sessions/:id/paste-image'); + } finally { + warn.mockRestore(); + } + }); }); // ========== GET /api/screenshots/:name ==========