chore(lint): replace any with unknown or typed shapes in tests
- DB introspection tests: introduce local RawDb alias for casts that poke into the private .db handle. - IPC handler tests: introduce IpcHandler alias matching the registerHandle signature (event + unknown args). - selective-ipc / session-management: narrow handler and data params to unknown or the minimum shape the code reads.
This commit is contained in:
1 parent
d42d895f2a
commit
0d044aeee8
9 files changed
+82
-34
No files matched your search
@@ -2,11 +2,18 @@ import { mkdtemp, rm } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import type { IpcMainInvokeEvent } from "electron";
|
||||
import type { DesktopResult } from "@shared/contracts";
|
||||
import { IPC_CHANNELS } from "@shared/contracts";
|
||||
import { AppDatabase } from "../../src/main/database";
|
||||
import { registerCoreAdminHandlers } from "../../src/main/ipc-core-admin-handlers";
|
||||
import { createThreadIntegration } from "../../src/main/thread-integration";
|
||||
|
||||
type IpcHandler = (
|
||||
event: IpcMainInvokeEvent,
|
||||
...args: unknown[]
|
||||
) => Promise<DesktopResult<unknown>> | DesktopResult<unknown>;
|
||||
|
||||
const tempDirs: string[] = [];
|
||||
|
||||
async function createTempDir(prefix: string) {
|
||||
@@ -109,7 +116,7 @@ describe("company mode switching", () => {
|
||||
expect(db.getTask(taskId).requiresUserReview).toBe(true);
|
||||
expect(db.getApprovalRecord(approvalId).state).toBe("pending");
|
||||
|
||||
const handlers = new Map<string, (...args: any[]) => any>();
|
||||
const handlers = new Map<string, IpcHandler>();
|
||||
registerCoreAdminHandlers({
|
||||
registerHandle: (channel, handler) => {
|
||||
handlers.set(channel, handler);
|
||||
@@ -130,7 +137,7 @@ describe("company mode switching", () => {
|
||||
throw new Error("saveCompany handler was not registered.");
|
||||
}
|
||||
|
||||
const result = await saveCompany(null, {
|
||||
const result = await saveCompany(null as unknown as IpcMainInvokeEvent, {
|
||||
id: companyId,
|
||||
name: "Mode Switch Co",
|
||||
description: "Execution mode cleanup",
|
||||
|
||||
Reference in new issue
Block a user