mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
chore(plugins): drop dead test any suppressions
This commit is contained in:
@@ -34,7 +34,6 @@ function createMiddlewareRes() {
|
||||
status: vi.fn(),
|
||||
json: vi.fn(),
|
||||
headersSent: false,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any;
|
||||
res.status.mockReturnValue(res);
|
||||
res.json.mockReturnValue(res);
|
||||
@@ -92,10 +91,8 @@ async function invokeWebhook(params: {
|
||||
const req = {
|
||||
headers,
|
||||
body: params.body,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any;
|
||||
const res = createMiddlewareRes();
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
await middleware(req, res, {} as any);
|
||||
return { res, onEvents: onEventsMock };
|
||||
}
|
||||
@@ -115,11 +112,9 @@ async function expectSignedRawBodyWins(params: { rawBody: string | Buffer; signe
|
||||
headers: { "x-line-signature": sign(rawBodyText, SECRET) },
|
||||
rawBody: params.rawBody,
|
||||
body: reqBody,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any;
|
||||
const res = createMiddlewareRes();
|
||||
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
await middleware(req, res, {} as any);
|
||||
|
||||
expect(res.status).toHaveBeenCalledWith(200);
|
||||
@@ -480,11 +475,9 @@ describe("createLineWebhookMiddleware", () => {
|
||||
headers: { "x-line-signature": sign(rawBody, SECRET) },
|
||||
rawBody,
|
||||
body: { events: [{ type: "message" }] },
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any;
|
||||
const res = createMiddlewareRes();
|
||||
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
await middleware(req, res, {} as any);
|
||||
|
||||
expect(res.status).toHaveBeenCalledWith(400);
|
||||
@@ -507,11 +500,9 @@ describe("createLineWebhookMiddleware", () => {
|
||||
const req = {
|
||||
headers: { "x-line-signature": sign(rawBody, SECRET) },
|
||||
body: rawBody,
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any;
|
||||
const res = createMiddlewareRes();
|
||||
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
await middleware(req, res, {} as any);
|
||||
|
||||
expect(res.status).toHaveBeenCalledWith(500);
|
||||
|
||||
@@ -45,7 +45,6 @@ describe("slack prepareSlackMessage inbound contract", () => {
|
||||
channels: { slack: { enabled: true } },
|
||||
} as OpenClawConfig,
|
||||
});
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
slackCtx.resolveUserName = async () => ({ name: "Alice" }) as any;
|
||||
return slackCtx;
|
||||
}
|
||||
@@ -138,7 +137,6 @@ describe("slack prepareSlackMessage inbound contract", () => {
|
||||
session: { dmScope: "main" },
|
||||
} as OpenClawConfig,
|
||||
});
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
slackCtx.resolveUserName = async () => ({ name: "Alice" }) as any;
|
||||
// Simulate API returning correct type for DM channel
|
||||
slackCtx.resolveChannelName = async () => ({ name: undefined, type: "im" as const });
|
||||
@@ -160,7 +158,6 @@ describe("slack prepareSlackMessage inbound contract", () => {
|
||||
options?: { includeFromCheck?: boolean },
|
||||
) {
|
||||
expect(prepared).toBeTruthy();
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expectInboundContextContract(prepared!.ctxPayload as any);
|
||||
expect(prepared!.isDirectMessage).toBe(true);
|
||||
expect(prepared!.route.sessionKey).toBe("agent:main:main");
|
||||
@@ -190,7 +187,6 @@ describe("slack prepareSlackMessage inbound contract", () => {
|
||||
? {}
|
||||
: { defaultRequireMention: params.defaultRequireMention }),
|
||||
});
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
slackCtx.resolveUserName = async () => ({ name: "Alice" }) as any;
|
||||
if (params?.asChannel) {
|
||||
slackCtx.resolveChannelName = async () => ({ name: "general", type: "channel" });
|
||||
@@ -210,7 +206,6 @@ describe("slack prepareSlackMessage inbound contract", () => {
|
||||
const prepared = await prepareWithDefaultCtx(message);
|
||||
|
||||
expect(prepared).toBeTruthy();
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expectInboundContextContract(prepared!.ctxPayload as any);
|
||||
});
|
||||
|
||||
@@ -225,7 +220,6 @@ describe("slack prepareSlackMessage inbound contract", () => {
|
||||
channels: { slack: { enabled: true } },
|
||||
} as OpenClawConfig,
|
||||
});
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
slackCtx.resolveUserName = async () => ({ name: "Alice" }) as any;
|
||||
|
||||
const prepared = await prepareMessageWith(slackCtx, defaultAccount, {
|
||||
@@ -303,7 +297,6 @@ describe("slack prepareSlackMessage inbound contract", () => {
|
||||
} as OpenClawConfig,
|
||||
defaultRequireMention: false,
|
||||
});
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
slackCtx.resolveUserName = async () => ({ name: "Bot" }) as any;
|
||||
|
||||
const account = createSlackAccount({ allowBots: true });
|
||||
@@ -338,7 +331,6 @@ describe("slack prepareSlackMessage inbound contract", () => {
|
||||
C123: { systemPrompt: "Config prompt" },
|
||||
},
|
||||
});
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
slackCtx.resolveUserName = async () => ({ name: "Alice" }) as any;
|
||||
const channelInfo = {
|
||||
name: "general",
|
||||
@@ -594,7 +586,6 @@ describe("slack prepareSlackMessage inbound contract", () => {
|
||||
} as OpenClawConfig,
|
||||
replyToMode: "all",
|
||||
});
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
slackCtx.resolveUserName = async () => ({ name: "Alice" }) as any;
|
||||
|
||||
const message = createSlackMessage({ ts: "500.000" });
|
||||
|
||||
@@ -22,12 +22,10 @@ const mockQuit = vi.fn();
|
||||
const mockUnbind = vi.fn();
|
||||
|
||||
// Event handler storage for testing
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const messageHandlers: Array<(channel: string, user: string, message: string, msg: any) => void> =
|
||||
[];
|
||||
|
||||
// Mock functions that track handlers and return unbind objects
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
const mockOnMessage = vi.fn((handler: any) => {
|
||||
messageHandlers.push(handler);
|
||||
return { unbind: mockUnbind };
|
||||
@@ -273,7 +271,6 @@ describe("TwitchClientManager", () => {
|
||||
|
||||
// Check the stored handler is handler2
|
||||
const key = manager.getAccountKey(testAccount);
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect((manager as any).messageHandlers.get(key)).toBe(handler2);
|
||||
});
|
||||
});
|
||||
@@ -295,9 +292,7 @@ describe("TwitchClientManager", () => {
|
||||
await manager.disconnect(testAccount);
|
||||
|
||||
const key = manager.getAccountKey(testAccount);
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect((manager as any).clients.has(key)).toBe(false);
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect((manager as any).messageHandlers.has(key)).toBe(false);
|
||||
});
|
||||
|
||||
@@ -316,7 +311,6 @@ describe("TwitchClientManager", () => {
|
||||
expect(mockQuit).toHaveBeenCalledTimes(1);
|
||||
|
||||
const key2 = manager.getAccountKey(testAccount2);
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect((manager as any).clients.has(key2)).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -329,9 +323,7 @@ describe("TwitchClientManager", () => {
|
||||
await manager.disconnectAll();
|
||||
|
||||
expect(mockQuit).toHaveBeenCalledTimes(2);
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect((manager as any).clients.size).toBe(0);
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
expect((manager as any).messageHandlers.size).toBe(0);
|
||||
});
|
||||
|
||||
@@ -399,7 +391,6 @@ describe("TwitchClientManager", () => {
|
||||
|
||||
it("should create client if not already connected", async () => {
|
||||
// Clear the existing client
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
(manager as any).clients.clear();
|
||||
|
||||
// Reset connect call count for this specific test
|
||||
|
||||
Reference in New Issue
Block a user