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.
This commit is contained in:
Maurice
2026-11-17 22:41:45 +00:00
parent c75fb22289
commit 70108e5694
2 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -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,
@@ -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') {