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:
ZacharyZhang-NY committed 2026-04-17 01:45:00 -04:00
1 parent d42d895f2a
commit 0d044aeee8
9 files changed
+82 -34

No files matched your search

+9 -2
View File
@@ -2,10 +2,17 @@ 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 { registerCoreAgentGraphHandlers } from "../../src/main/ipc-core-agent-graph-handlers";
type IpcHandler = (
event: IpcMainInvokeEvent,
...args: unknown[]
) => Promise<DesktopResult<unknown>> | DesktopResult<unknown>;
const tempDirs: string[] = [];
async function createTempDir(prefix: string) {
@@ -60,7 +67,7 @@ describe("ipc-core-agent-graph-handlers model enforcement", () => {
budgetMonthlyUsd: 250,
});
const handlers = new Map<string, (...args: any[]) => any>();
const handlers = new Map<string, IpcHandler>();
registerCoreAgentGraphHandlers({
registerHandle: (channel, handler) => {
handlers.set(channel, handler);
@@ -77,7 +84,7 @@ describe("ipc-core-agent-graph-handlers model enforcement", () => {
throw new Error("saveAgent handler was not registered.");
}
const result = await saveAgent(null, {
const result = await saveAgent(null as unknown as IpcMainInvokeEvent, {
id: agentId,
companyId,
name: "CEO",