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:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user