test(shared): remove unsafe test assertions

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-05-12 14:22:51 +09:00
parent f05aeaa63a
commit 8b093a1115
6 changed files with 36 additions and 37 deletions
+8 -8
View File
@@ -5,7 +5,7 @@ import { OpenClawConfigSchema } from "../../config/schema/openclaw"
describe("OpenClaw Config", () => {
test("resolveGateway resolves HTTP gateway", () => {
const config: OpenClawConfig = {
const config: OpenClawConfig = testCoerce({
enabled: true,
gateways: {
discord: {
@@ -20,7 +20,7 @@ describe("OpenClaw Config", () => {
instruction: "Started session {{sessionId}}",
},
},
} as any
})
const resolved = resolveGateway(config, "session-start")
expect(resolved).not.toBeNull()
@@ -30,31 +30,31 @@ describe("OpenClaw Config", () => {
})
test("resolveGateway returns null for disabled config", () => {
const config: OpenClawConfig = {
const config: OpenClawConfig = testCoerce({
enabled: false,
gateways: {},
hooks: {},
} as any
})
expect(resolveGateway(config, "session-start")).toBeNull()
})
test("resolveGateway returns null for unknown hook", () => {
const config: OpenClawConfig = {
const config: OpenClawConfig = testCoerce({
enabled: true,
gateways: {},
hooks: {},
} as any
})
expect(resolveGateway(config, "unknown")).toBeNull()
})
test("resolveGateway returns null for disabled hook", () => {
const config: OpenClawConfig = {
const config: OpenClawConfig = testCoerce({
enabled: true,
gateways: { g: { type: "http", url: "https://example.com" } },
hooks: {
event: { enabled: false, gateway: "g", instruction: "i" },
},
} as any
})
expect(resolveGateway(config, "event")).toBeNull()
})
@@ -75,7 +75,7 @@ describe("pollDiscordReplies", () => {
status: 401,
}),
))
globalThis.fetch = fetchMock as unknown as typeof fetch
globalThis.fetch = testCoerce<typeof fetch>(fetchMock)
const state = createState()
@@ -109,7 +109,7 @@ describe("pollDiscordReplies", () => {
),
)
.mockResolvedValueOnce(new Response(null, { status: 204 }))
globalThis.fetch = fetchMock as unknown as typeof fetch
globalThis.fetch = testCoerce<typeof fetch>(fetchMock)
const lookupSpy = spyOn(sessionRegistryModule, "lookupByMessageId").mockReturnValue({
sessionId: "ses-1",
tmuxSession: "session-1",