From c4d05b0dfc68fc16d3034f033b74b592baa9aed6 Mon Sep 17 00:00:00 2001 From: Shakker Date: Sat, 9 May 2026 05:00:31 +0100 Subject: [PATCH] test: tighten messaging plugin array assertions --- extensions/device-pair/notify.test.ts | 2 +- extensions/feishu/src/post.test.ts | 6 +++--- extensions/feishu/src/sequential-queue.test.ts | 4 ++-- extensions/googlechat/src/secret-contract.test.ts | 2 +- extensions/inworld/tts.test.ts | 2 +- extensions/line/src/channel.status.test.ts | 2 +- extensions/line/src/setup-surface.test.ts | 4 ++-- extensions/nostr/src/channel.test.ts | 8 ++++---- extensions/nostr/src/nostr-profile.test.ts | 2 +- extensions/phone-control/index.test.ts | 2 +- extensions/qqbot/src/engine/access/sender-match.test.ts | 4 ++-- extensions/qqbot/src/engine/config/group.test.ts | 2 +- extensions/qqbot/src/engine/config/resolve.test.ts | 2 +- .../qqbot/src/engine/engine-import-boundary.test.ts | 2 +- extensions/qqbot/src/engine/group/history.test.ts | 4 ++-- extensions/qqbot/src/secret-contract.test.ts | 2 +- extensions/synology-chat/src/channel.test.ts | 4 ++-- extensions/synology-chat/src/core.test.ts | 4 ++-- extensions/tlon/src/core.test.ts | 2 +- extensions/tlon/src/monitor/settings-helpers.test.ts | 6 +++--- extensions/webhooks/src/http.test.ts | 2 +- extensions/zalo/src/channel.directory.test.ts | 2 +- extensions/zalo/src/send.test.ts | 4 ++-- extensions/zalouser/src/monitor.group-gating.test.ts | 2 +- extensions/zalouser/src/send.test.ts | 4 ++-- extensions/zalouser/src/setup-surface.test.ts | 4 ++-- extensions/zalouser/src/zalo-js.credentials.test.ts | 4 ++-- 27 files changed, 44 insertions(+), 44 deletions(-) diff --git a/extensions/device-pair/notify.test.ts b/extensions/device-pair/notify.test.ts index 07eee4822c8..9b4166a0e16 100644 --- a/extensions/device-pair/notify.test.ts +++ b/extensions/device-pair/notify.test.ts @@ -88,7 +88,7 @@ describe("device-pair notify persistence", () => { const persisted = JSON.parse( await fs.readFile(path.join(stateDir, "device-pair-notify.json"), "utf8"), ) as { subscribers: unknown[] }; - expect(persisted.subscribers).toEqual([]); + expect(persisted.subscribers).toStrictEqual([]); }); it("does not remove a different persisted subscriber when notify fields contain pipes", async () => { diff --git a/extensions/feishu/src/post.test.ts b/extensions/feishu/src/post.test.ts index 2a27a5aa2f1..5b399546820 100644 --- a/extensions/feishu/src/post.test.ts +++ b/extensions/feishu/src/post.test.ts @@ -25,8 +25,8 @@ describe("parsePostContent", () => { expect(result.textContent).toBe( "Daily \\*Plan\\*\n\n**Bold** *Italic* Underline ~~Strike~~ `Code`", ); - expect(result.imageKeys).toEqual([]); - expect(result.mentionedOpenIds).toEqual([]); + expect(result.imageKeys).toStrictEqual([]); + expect(result.mentionedOpenIds).toStrictEqual([]); }); it("renders links and mentions", () => { @@ -70,7 +70,7 @@ describe("parsePostContent", () => { expect(result.textContent).toBe("Before ![image] after\n![image]"); expect(result.imageKeys).toEqual(["img_1", "img_2"]); - expect(result.mentionedOpenIds).toEqual([]); + expect(result.mentionedOpenIds).toStrictEqual([]); }); it("supports locale wrappers", () => { diff --git a/extensions/feishu/src/sequential-queue.test.ts b/extensions/feishu/src/sequential-queue.test.ts index bf66c200bcb..3e4ac816742 100644 --- a/extensions/feishu/src/sequential-queue.test.ts +++ b/extensions/feishu/src/sequential-queue.test.ts @@ -85,7 +85,7 @@ describe("createSequentialQueue", () => { ).rejects.toThrow("boom"); await new Promise((resolve) => setTimeout(resolve, 0)); - expect(unhandled).toEqual([]); + expect(unhandled).toStrictEqual([]); await expect( enqueue("feishu:default:chat-1", async () => { @@ -156,7 +156,7 @@ describe("createSequentialQueue", () => { // Wait long enough that a timeout would have fired if it were active. await vi.advanceTimersByTimeAsync(30); expect(order).toEqual(["first:start"]); - expect(timeouts).toEqual([]); + expect(timeouts).toStrictEqual([]); gate.resolve(); await Promise.all([first, second]); diff --git a/extensions/googlechat/src/secret-contract.test.ts b/extensions/googlechat/src/secret-contract.test.ts index 7a7b24061d0..5193da91234 100644 --- a/extensions/googlechat/src/secret-contract.test.ts +++ b/extensions/googlechat/src/secret-contract.test.ts @@ -55,6 +55,6 @@ describe("googlechat secret contract", () => { const workAccount = resolvedConfig.channels?.googlechat?.accounts?.work; expect(workAccount?.serviceAccount).toBe('{"client_email":"bot@example.com"}'); - expect(context.warnings).toEqual([]); + expect(context.warnings).toStrictEqual([]); }); }); diff --git a/extensions/inworld/tts.test.ts b/extensions/inworld/tts.test.ts index 71e922bd4aa..9dd55c54522 100644 --- a/extensions/inworld/tts.test.ts +++ b/extensions/inworld/tts.test.ts @@ -180,7 +180,7 @@ describe("listInworldVoices", () => { queueGuardedResponse(new Response(JSON.stringify({}), { status: 200 })); const voices = await listInworldVoices({ apiKey: "test-key" }); - expect(voices).toEqual([]); + expect(voices).toStrictEqual([]); }); it("passes language filter as query parameter", async () => { diff --git a/extensions/line/src/channel.status.test.ts b/extensions/line/src/channel.status.test.ts index eac89a5e1f7..68ac34223d3 100644 --- a/extensions/line/src/channel.status.test.ts +++ b/extensions/line/src/channel.status.test.ts @@ -20,7 +20,7 @@ describe("linePlugin status.collectStatusIssues", () => { tokenSource: "env", }, ]), - ).toEqual([]); + ).toStrictEqual([]); }); it("reports missing access token when the snapshot is unconfigured and tokenSource is none", () => { diff --git a/extensions/line/src/setup-surface.test.ts b/extensions/line/src/setup-surface.test.ts index a2438015877..f47cb1c9455 100644 --- a/extensions/line/src/setup-surface.test.ts +++ b/extensions/line/src/setup-surface.test.ts @@ -382,8 +382,8 @@ describe("linePlugin status.probeAccount", () => { describe("line runtime api", () => { it("keeps the LINE runtime barrel self-contained", () => { const runtimeApiPath = path.join(process.cwd(), "extensions", "line", "runtime-api.ts"); - expect(collectRuntimeApiPreExports(runtimeApiPath)).toEqual([]); - expect(collectRuntimeApiPreExports(runtimeApiPath)).toEqual([]); + expect(collectRuntimeApiPreExports(runtimeApiPath)).toStrictEqual([]); + expect(collectRuntimeApiPreExports(runtimeApiPath)).toStrictEqual([]); }); }); diff --git a/extensions/nostr/src/channel.test.ts b/extensions/nostr/src/channel.test.ts index 02c96a8e98c..421df762a6a 100644 --- a/extensions/nostr/src/channel.test.ts +++ b/extensions/nostr/src/channel.test.ts @@ -145,7 +145,7 @@ const unresolvedSecretRefPrivateKeyCases = [ { name: "listNostrAccountIds", assert: (cfg: ReturnType) => { - expect(listNostrAccountIds(cfg)).toEqual([]); + expect(listNostrAccountIds(cfg)).toStrictEqual([]); }, }, { @@ -192,7 +192,7 @@ describe("nostrPlugin", () => { it("listAccountIds returns empty array for unconfigured", () => { const cfg = { channels: {} }; const ids = nostrTestPlugin.config.listAccountIds(cfg); - expect(ids).toEqual([]); + expect(ids).toStrictEqual([]); }); it("listAccountIds returns default for configured", () => { @@ -370,12 +370,12 @@ describe("nostr account helpers", () => { describe("listNostrAccountIds", () => { it("returns empty array when not configured", () => { const cfg = { channels: {} }; - expect(listNostrAccountIds(cfg)).toEqual([]); + expect(listNostrAccountIds(cfg)).toStrictEqual([]); }); it("returns empty array when nostr section exists but no privateKey", () => { const cfg = { channels: { nostr: { enabled: true } } }; - expect(listNostrAccountIds(cfg)).toEqual([]); + expect(listNostrAccountIds(cfg)).toStrictEqual([]); }); it("returns default when privateKey is configured", () => { diff --git a/extensions/nostr/src/nostr-profile.test.ts b/extensions/nostr/src/nostr-profile.test.ts index 704a89528cf..dab6343a786 100644 --- a/extensions/nostr/src/nostr-profile.test.ts +++ b/extensions/nostr/src/nostr-profile.test.ts @@ -133,7 +133,7 @@ describe("createProfileEvent", () => { expect(event.kind).toBe(0); expect(event.pubkey).toBe(TEST_PUBKEY); - expect(event.tags).toEqual([]); + expect(event.tags).toStrictEqual([]); expect(event.id).toMatch(/^[0-9a-f]{64}$/); expect(event.sig).toMatch(/^[0-9a-f]{128}$/); }); diff --git a/extensions/phone-control/index.test.ts b/extensions/phone-control/index.test.ts index 4e1b5ad7a60..8f6e204fd71 100644 --- a/extensions/phone-control/index.test.ts +++ b/extensions/phone-control/index.test.ts @@ -126,7 +126,7 @@ describe("phone-control plugin", () => { expect(writeConfigFile).toHaveBeenCalledTimes(1); expect(nodes.allowCommands).toEqual([...WRITE_COMMANDS]); - expect(nodes.denyCommands).toEqual([]); + expect(nodes.denyCommands).toStrictEqual([]); expect(text).toContain("sms.send"); }); }); diff --git a/extensions/qqbot/src/engine/access/sender-match.test.ts b/extensions/qqbot/src/engine/access/sender-match.test.ts index 3c39ee0d8d4..4cfa05592c7 100644 --- a/extensions/qqbot/src/engine/access/sender-match.test.ts +++ b/extensions/qqbot/src/engine/access/sender-match.test.ts @@ -32,8 +32,8 @@ describe("normalizeQQBotAllowFrom", () => { }); it("returns empty array for undefined/null", () => { - expect(normalizeQQBotAllowFrom(undefined)).toEqual([]); - expect(normalizeQQBotAllowFrom(null)).toEqual([]); + expect(normalizeQQBotAllowFrom(undefined)).toStrictEqual([]); + expect(normalizeQQBotAllowFrom(null)).toStrictEqual([]); }); }); diff --git a/extensions/qqbot/src/engine/config/group.test.ts b/extensions/qqbot/src/engine/config/group.test.ts index c8457dd4945..8dc5770c5dd 100644 --- a/extensions/qqbot/src/engine/config/group.test.ts +++ b/extensions/qqbot/src/engine/config/group.test.ts @@ -162,7 +162,7 @@ describe("engine/config/group", () => { describe("resolveMentionPatterns", () => { it("returns [] when nothing configured", () => { - expect(resolveMentionPatterns({})).toEqual([]); + expect(resolveMentionPatterns({})).toStrictEqual([]); }); it("reads global patterns", () => { diff --git a/extensions/qqbot/src/engine/config/resolve.test.ts b/extensions/qqbot/src/engine/config/resolve.test.ts index 42fd08ce1e2..8c083242c44 100644 --- a/extensions/qqbot/src/engine/config/resolve.test.ts +++ b/extensions/qqbot/src/engine/config/resolve.test.ts @@ -8,7 +8,7 @@ import { describe("engine/config/resolve", () => { it("returns empty list when no accounts configured", () => { - expect(listAccountIds({})).toEqual([]); + expect(listAccountIds({})).toStrictEqual([]); }); it("returns default when top-level appId is set", () => { diff --git a/extensions/qqbot/src/engine/engine-import-boundary.test.ts b/extensions/qqbot/src/engine/engine-import-boundary.test.ts index 41bb38e0ae3..31b7c7b04ab 100644 --- a/extensions/qqbot/src/engine/engine-import-boundary.test.ts +++ b/extensions/qqbot/src/engine/engine-import-boundary.test.ts @@ -68,6 +68,6 @@ describe("engine import boundary", () => { } } - expect(offenders).toEqual([]); + expect(offenders).toStrictEqual([]); }); }); diff --git a/extensions/qqbot/src/engine/group/history.test.ts b/extensions/qqbot/src/engine/group/history.test.ts index 2999168baed..ad6a48ce230 100644 --- a/extensions/qqbot/src/engine/group/history.test.ts +++ b/extensions/qqbot/src/engine/group/history.test.ts @@ -157,7 +157,7 @@ describe("engine/group/history", () => { entry: entry("A", "hi"), limit: 0, }); - expect(entries).toEqual([]); + expect(entries).toStrictEqual([]); expect(map.size).toBe(0); }); @@ -301,7 +301,7 @@ describe("engine/group/history", () => { limit: 5, }); clearPendingHistory({ historyMap: map, historyKey: "G", limit: 5 }); - expect(map.get("G")).toEqual([]); + expect(map.get("G")).toStrictEqual([]); }); it("no-ops when disabled", () => { diff --git a/extensions/qqbot/src/secret-contract.test.ts b/extensions/qqbot/src/secret-contract.test.ts index 0b12103555d..8f201eb15af 100644 --- a/extensions/qqbot/src/secret-contract.test.ts +++ b/extensions/qqbot/src/secret-contract.test.ts @@ -30,7 +30,7 @@ async function resolveQqbotSecretAssignments( ); applyResolvedAssignments({ assignments: context.assignments, resolved }); - expect(context.warnings).toEqual([]); + expect(context.warnings).toStrictEqual([]); return resolvedConfig; } diff --git a/extensions/synology-chat/src/channel.test.ts b/extensions/synology-chat/src/channel.test.ts index c40969d5707..7ae82f1bb75 100644 --- a/extensions/synology-chat/src/channel.test.ts +++ b/extensions/synology-chat/src/channel.test.ts @@ -381,8 +381,8 @@ describe("createSynologyChatPlugin", () => { const plugin = createSynologyChatPlugin(); const params = { cfg: {}, runtime: {} as never }; expect(await plugin.directory.self?.(params)).toBeNull(); - expect(await plugin.directory.listPeers?.(params)).toEqual([]); - expect(await plugin.directory.listGroups?.(params)).toEqual([]); + expect(await plugin.directory.listPeers?.(params)).toStrictEqual([]); + expect(await plugin.directory.listGroups?.(params)).toStrictEqual([]); }); }); diff --git a/extensions/synology-chat/src/core.test.ts b/extensions/synology-chat/src/core.test.ts index 64789d6902b..9987b9f23b3 100644 --- a/extensions/synology-chat/src/core.test.ts +++ b/extensions/synology-chat/src/core.test.ts @@ -145,8 +145,8 @@ describe("synology-chat core", () => { describe("synology-chat account resolution", () => { it("lists no accounts when the channel is missing", () => { - expect(listAccountIds({})).toEqual([]); - expect(listAccountIds({ channels: {} })).toEqual([]); + expect(listAccountIds({})).toStrictEqual([]); + expect(listAccountIds({ channels: {} })).toStrictEqual([]); }); it("lists the default account when base config has a token", () => { diff --git a/extensions/tlon/src/core.test.ts b/extensions/tlon/src/core.test.ts index dd7c8673262..ccccc4a8d7f 100644 --- a/extensions/tlon/src/core.test.ts +++ b/extensions/tlon/src/core.test.ts @@ -62,7 +62,7 @@ describe("tlon core", () => { cfg: {} as OpenClawConfig, accountId: "default", }), - ).toEqual([]); + ).toStrictEqual([]); }); it("resolves dm allowlist from the default account", () => { diff --git a/extensions/tlon/src/monitor/settings-helpers.test.ts b/extensions/tlon/src/monitor/settings-helpers.test.ts index 256b5e1038e..ba5fbdb4d20 100644 --- a/extensions/tlon/src/monitor/settings-helpers.test.ts +++ b/extensions/tlon/src/monitor/settings-helpers.test.ts @@ -74,8 +74,8 @@ describe("applyTlonSettingsOverrides", () => { }, }); - expect(result.effectiveDmAllowlist).toEqual([]); - expect(result.effectiveGroupInviteAllowlist).toEqual([]); + expect(result.effectiveDmAllowlist).toStrictEqual([]); + expect(result.effectiveGroupInviteAllowlist).toStrictEqual([]); }); it("falls back to file config when settings fields are removed", () => { @@ -108,6 +108,6 @@ describe("applyTlonSettingsOverrides", () => { expect(result.effectiveAutoAcceptGroupInvites).toBe(false); expect(result.effectiveShowModelSig).toBe(true); expect(result.effectiveOwnerShip).toBe("~nec"); - expect(result.pendingApprovals).toEqual([]); + expect(result.pendingApprovals).toStrictEqual([]); }); }); diff --git a/extensions/webhooks/src/http.test.ts b/extensions/webhooks/src/http.test.ts index 2551acdfcdd..db0e01c9ab9 100644 --- a/extensions/webhooks/src/http.test.ts +++ b/extensions/webhooks/src/http.test.ts @@ -137,7 +137,7 @@ describe("createTaskFlowWebhookRequestHandler", () => { expect(res.statusCode).toBe(401); expect(res.body).toBe("unauthorized"); - expect(target.taskFlow.list()).toEqual([]); + expect(target.taskFlow.list()).toStrictEqual([]); expect(hoisted.resolveConfiguredSecretInputStringMock).not.toHaveBeenCalled(); }); diff --git a/extensions/zalo/src/channel.directory.test.ts b/extensions/zalo/src/channel.directory.test.ts index 9fe160e0051..b9e20a09b80 100644 --- a/extensions/zalo/src/channel.directory.test.ts +++ b/extensions/zalo/src/channel.directory.test.ts @@ -43,7 +43,7 @@ describe("zalo directory", () => { limit: undefined, runtime: runtimeEnv, }), - ).resolves.toEqual([]); + ).resolves.toStrictEqual([]); } it("lists peers from allowFrom", async () => { diff --git a/extensions/zalo/src/send.test.ts b/extensions/zalo/src/send.test.ts index d0567fbf520..eb282c84967 100644 --- a/extensions/zalo/src/send.test.ts +++ b/extensions/zalo/src/send.test.ts @@ -101,7 +101,7 @@ describe("zalo send", () => { ok: false, error: "No Zalo bot token configured", }); - expect(missingToken.receipt.platformMessageIds).toEqual([]); + expect(missingToken.receipt.platformMessageIds).toStrictEqual([]); const blankPhoto = await sendPhotoZalo("dm-chat-4", " ", { token: "zalo-token", @@ -110,7 +110,7 @@ describe("zalo send", () => { ok: false, error: "No photo URL provided", }); - expect(blankPhoto.receipt.platformMessageIds).toEqual([]); + expect(blankPhoto.receipt.platformMessageIds).toStrictEqual([]); expect(sendMessageMock).not.toHaveBeenCalled(); expect(sendPhotoMock).not.toHaveBeenCalled(); diff --git a/extensions/zalouser/src/monitor.group-gating.test.ts b/extensions/zalouser/src/monitor.group-gating.test.ts index c0ec05578c4..b8e2a54afe1 100644 --- a/extensions/zalouser/src/monitor.group-gating.test.ts +++ b/extensions/zalouser/src/monitor.group-gating.test.ts @@ -890,6 +890,6 @@ describe("zalouser monitor group mention gating", () => { }); expect(dispatchReplyWithBufferedBlockDispatcher).toHaveBeenCalledTimes(2); const secondDispatch = dispatchReplyWithBufferedBlockDispatcher.mock.calls[1]?.[0]; - expect(secondDispatch?.ctx?.InboundHistory).toEqual([]); + expect(secondDispatch?.ctx?.InboundHistory).toStrictEqual([]); }); }); diff --git a/extensions/zalouser/src/send.test.ts b/extensions/zalouser/src/send.test.ts index 3904882dd21..db90caa9dbe 100644 --- a/extensions/zalouser/src/send.test.ts +++ b/extensions/zalouser/src/send.test.ts @@ -178,7 +178,7 @@ describe("zalouser send helpers", () => { mockSendText.mock.calls .map((call, index) => ({ index, length: call[1].length })) .filter((call) => call.length > 2000), - ).toEqual([]); + ).toStrictEqual([]); expect(result).toMatchObject({ ok: true, messageId: "mid-2c-2" }); }); @@ -388,7 +388,7 @@ describe("zalouser send helpers", () => { remove: undefined, }); expect(result).toMatchObject({ ok: true, error: undefined }); - expect(result.receipt.platformMessageIds).toEqual([]); + expect(result.receipt.platformMessageIds).toStrictEqual([]); }); it("delegates delivered+seen helpers to JS transport", async () => { diff --git a/extensions/zalouser/src/setup-surface.test.ts b/extensions/zalouser/src/setup-surface.test.ts index 8db8aef861f..78a30e565b6 100644 --- a/extensions/zalouser/src/setup-surface.test.ts +++ b/extensions/zalouser/src/setup-surface.test.ts @@ -142,7 +142,7 @@ describe("zalouser setup wizard", () => { }); expectEnabledDefaultSetup(result, "allowlist"); - expect(result.cfg.channels?.zalouser?.allowFrom).toEqual([]); + expect(result.cfg.channels?.zalouser?.allowFrom).toStrictEqual([]); expect( note.mock.calls.some(([message]) => message.includes("No DM allowlist entries added yet.")), ).toBe(true); @@ -214,7 +214,7 @@ describe("zalouser setup wizard", () => { const result = await runSetup({ prompter, forceAllowFrom: true }); expect(result.cfg.channels?.zalouser?.dmPolicy).toBe("allowlist"); - expect(result.cfg.channels?.zalouser?.allowFrom).toEqual([]); + expect(result.cfg.channels?.zalouser?.allowFrom).toStrictEqual([]); expect(seen).not.toContain("Zalo Personal DM policy"); expect(seen).toContain("Zalouser allowFrom (name or user id)"); expect( diff --git a/extensions/zalouser/src/zalo-js.credentials.test.ts b/extensions/zalouser/src/zalo-js.credentials.test.ts index a7036010124..76ba371e506 100644 --- a/extensions/zalouser/src/zalo-js.credentials.test.ts +++ b/extensions/zalouser/src/zalo-js.credentials.test.ts @@ -311,7 +311,7 @@ describe("zalouser credential persistence", () => { try { await withEnvAsync({ OPENCLAW_STATE_DIR: stateDir }, async () => { - await expect(listZaloFriends(profile)).resolves.toEqual([]); + await expect(listZaloFriends(profile)).resolves.toStrictEqual([]); const firstRaw = await readFile(filePath, "utf8"); const stableMtime = new Date("2026-04-01T00:00:10.000Z"); await utimes(filePath, stableMtime, stableMtime); @@ -319,7 +319,7 @@ describe("zalouser credential persistence", () => { currentCookie = cookieB; - await expect(listZaloFriends(profile)).resolves.toEqual([]); + await expect(listZaloFriends(profile)).resolves.toStrictEqual([]); expect(await readFile(filePath, "utf8")).toBe(firstRaw); expect((await stat(filePath)).mtimeMs).toBe(firstMtimeMs); });