From 70108e56940e321d23d51206d2ddae36226957fe Mon Sep 17 00:00:00 2001 From: Maurice Date: Tue, 17 Nov 2026 22:41:45 +0000 Subject: [PATCH] test(memories): type the Synology fakes' request init as RequestInit The fakes that answer safeFetch by API took their init as any; safeFetch declares it as RequestInit, which is what they read (the body as URLSearchParams or text). The SSRF album case had gained one more of them, which put the tests' no-explicit-any count one over its baseline. All five are typed now, and the baseline is lowered to the 1545 the tests hold. --- server/scripts/eslint-baseline.json | 2 +- server/tests/integration/memories-synology.test.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/server/scripts/eslint-baseline.json b/server/scripts/eslint-baseline.json index f02cd93d8..f81965340 100644 --- a/server/scripts/eslint-baseline.json +++ b/server/scripts/eslint-baseline.json @@ -16,7 +16,7 @@ "no-misleading-character-class": 1 }, "tests": { - "@typescript-eslint/no-explicit-any": 1549, + "@typescript-eslint/no-explicit-any": 1545, "@typescript-eslint/no-non-null-assertion": 1747, "@typescript-eslint/no-require-imports": 25, "@typescript-eslint/no-unsafe-function-type": 7, diff --git a/server/tests/integration/memories-synology.test.ts b/server/tests/integration/memories-synology.test.ts index 8ccf387c6..ab48b841e 100644 --- a/server/tests/integration/memories-synology.test.ts +++ b/server/tests/integration/memories-synology.test.ts @@ -418,7 +418,7 @@ describe('Synology listSynologyAlbums multi-source merge', () => { const { user } = await makeUser(orm); await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass'); - vi.mocked(safeFetch).mockImplementation((_url: string, init?: any) => { + vi.mocked(safeFetch).mockImplementation((_url: string, init?: RequestInit) => { // Always read both URL params and body params; body takes precedence for request-specific fields. const urlParams = (() => { try { @@ -485,7 +485,7 @@ describe('Synology listSynologyAlbums multi-source merge', () => { const { user } = await makeUser(orm); await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass'); - vi.mocked(safeFetch).mockImplementation((_url: string, init?: any) => { + vi.mocked(safeFetch).mockImplementation((_url: string, init?: RequestInit) => { const urlParams = (() => { try { return new URL(String(_url)).searchParams; @@ -572,7 +572,7 @@ describe('Synology listSynologyAlbums multi-source merge', () => { const { user } = await makeUser(orm); await setSynologyCredentials(orm, user.id, 'https://synology.example.com', 'admin', 'pass'); - vi.mocked(safeFetch).mockImplementation((_url: string, init?: any) => { + vi.mocked(safeFetch).mockImplementation((_url: string, init?: RequestInit) => { const urlParams = (() => { try { return new URL(String(_url)).searchParams; @@ -994,7 +994,7 @@ describe('Synology session retry on error codes 106/107/119', () => { json: async () => body, body: null, } as any); - vi.mocked(safeFetch).mockImplementation((_url: string, init?: any) => { + vi.mocked(safeFetch).mockImplementation((_url: string, init?: RequestInit) => { const params: URLSearchParams = init?.body instanceof URLSearchParams ? init.body : new URLSearchParams(String(init?.body ?? '')); const api = params.get('api') || ''; @@ -1269,7 +1269,7 @@ describe('Synology SSRF blocked error handling', () => { // reaches the fake first depends on how database reads interleave on each engine: the // fake answers by API and category, not by call position. const savedImpl = vi.mocked(safeFetch).getMockImplementation(); - vi.mocked(safeFetch).mockImplementation((_url: string, init?: any) => { + vi.mocked(safeFetch).mockImplementation((_url: string, init?: RequestInit) => { const params: URLSearchParams = init?.body instanceof URLSearchParams ? init.body : new URLSearchParams(String(init?.body ?? '')); if (params.get('api') === 'SYNO.API.Auth') {