mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-13 15:47:28 +00:00
test: tighten messaging empty array assertions
This commit is contained in:
@@ -195,7 +195,7 @@ describe("matrixMessageActions", () => {
|
||||
}
|
||||
const actions = discovery.actions;
|
||||
|
||||
expect(actions).toEqual([]);
|
||||
expect(actions).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("honors the selected Matrix account during discovery", () => {
|
||||
|
||||
@@ -104,7 +104,7 @@ describe("matrix directory live", () => {
|
||||
query: " ",
|
||||
});
|
||||
|
||||
expect(result).toEqual([]);
|
||||
expect(result).toStrictEqual([]);
|
||||
expect(resolveMatrixAuth).not.toHaveBeenCalled();
|
||||
expect(requestJsonMock).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -115,7 +115,7 @@ describe("matrix directory live", () => {
|
||||
query: "",
|
||||
});
|
||||
|
||||
expect(result).toEqual([]);
|
||||
expect(result).toStrictEqual([]);
|
||||
expect(resolveMatrixAuth).not.toHaveBeenCalled();
|
||||
expect(requestJsonMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -383,7 +383,7 @@ describe("matrix doctor", () => {
|
||||
} as never,
|
||||
});
|
||||
|
||||
expect(result.changes).toEqual([]);
|
||||
expect(result.changes).toStrictEqual([]);
|
||||
expect(result.config).toEqual({
|
||||
channels: {
|
||||
matrix: {
|
||||
|
||||
@@ -152,7 +152,7 @@ describe("matrix exec approvals", () => {
|
||||
it("ignores wildcard allowlist entries when inferring exec approvers", () => {
|
||||
const cfg = buildConfig({ enabled: true }, { dm: { allowFrom: ["*"] } });
|
||||
|
||||
expect(getMatrixExecApprovalApprovers({ cfg })).toEqual([]);
|
||||
expect(getMatrixExecApprovalApprovers({ cfg })).toStrictEqual([]);
|
||||
expect(isMatrixExecApprovalClientEnabled({ cfg })).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ describe("matrix legacy encrypted-state migration", () => {
|
||||
|
||||
const detection = detectLegacyMatrixCrypto({ cfg, env: process.env });
|
||||
expect(detection.inspectorAvailable).toBe(true);
|
||||
expect(detection.warnings).toEqual([]);
|
||||
expect(detection.warnings).toStrictEqual([]);
|
||||
expect(detection.plans).toHaveLength(1);
|
||||
|
||||
const result = await autoPrepareLegacyMatrixCrypto({
|
||||
@@ -110,7 +110,7 @@ describe("matrix legacy encrypted-state migration", () => {
|
||||
});
|
||||
|
||||
expect(result.migrated).toBe(true);
|
||||
expect(result.warnings).toEqual([]);
|
||||
expect(result.warnings).toStrictEqual([]);
|
||||
|
||||
const recovery = JSON.parse(
|
||||
fs.readFileSync(path.join(rootDir, "recovery-key.json"), "utf8"),
|
||||
|
||||
@@ -35,7 +35,7 @@ describe("matrix legacy state migration", () => {
|
||||
|
||||
const result = await autoMigrateLegacyMatrixState({ cfg, env: process.env });
|
||||
expect(result.migrated).toBe(true);
|
||||
expect(result.warnings).toEqual([]);
|
||||
expect(result.warnings).toStrictEqual([]);
|
||||
expect(fs.existsSync(path.join(stateDir, "matrix", "bot-storage.json"))).toBe(false);
|
||||
expect(fs.existsSync(path.join(stateDir, "matrix", "crypto"))).toBe(false);
|
||||
expect(fs.existsSync(detection.targetStoragePath)).toBe(true);
|
||||
|
||||
@@ -118,7 +118,7 @@ describe("matrix reaction actions", () => {
|
||||
|
||||
const result = await listMatrixReactions("!room:example.org", "$msg", { client });
|
||||
|
||||
expect(result).toEqual([]);
|
||||
expect(result).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("rejects blank message ids before querying Matrix relations", async () => {
|
||||
|
||||
@@ -126,7 +126,7 @@ describe("inspectMatrixDirectRooms", () => {
|
||||
});
|
||||
|
||||
expect(result.activeRoomId).toBeNull();
|
||||
expect(result.discoveredStrictRoomIds).toEqual([]);
|
||||
expect(result.discoveredStrictRoomIds).toStrictEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ describe("resolveMatrixMonitorAccessState", () => {
|
||||
isRoom: false,
|
||||
});
|
||||
|
||||
expect(state.effectiveAllowFrom).toEqual([]);
|
||||
expect(state.effectiveAllowFrom).toStrictEqual([]);
|
||||
expect(state.directAllowMatch.allowed).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ describe("resolveMatrixMonitorConfig", () => {
|
||||
resolveTargets,
|
||||
});
|
||||
|
||||
expect(result.allowFrom).toEqual([]);
|
||||
expect(result.allowFrom).toStrictEqual([]);
|
||||
expect(result.groupAllowFrom).toEqual(["@known:example.org"]);
|
||||
expect(result.roomsConfig).toStrictEqual({});
|
||||
expect(resolveTargets).toHaveBeenNthCalledWith(
|
||||
|
||||
@@ -508,7 +508,7 @@ describe("monitorMatrixProvider", () => {
|
||||
|
||||
await monitorMatrixProvider({ abortSignal: abortController.signal });
|
||||
|
||||
expect(hoisted.callOrder).toEqual([]);
|
||||
expect(hoisted.callOrder).toStrictEqual([]);
|
||||
expect(hoisted.resolveTextChunkLimit).not.toHaveBeenCalled();
|
||||
expect(hoisted.createMatrixRoomMessageHandler).not.toHaveBeenCalled();
|
||||
expect(hoisted.setActiveMatrixClient).not.toHaveBeenCalled();
|
||||
|
||||
@@ -103,7 +103,7 @@ describe("Matrix IndexedDB persistence", () => {
|
||||
expect(restored).toBe(false);
|
||||
|
||||
const dbs = await indexedDB.databases();
|
||||
expect(dbs).toEqual([]);
|
||||
expect(dbs).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("returns false without warning when the snapshot does not exist yet", async () => {
|
||||
|
||||
@@ -162,7 +162,7 @@ describe("MatrixVerificationManager", () => {
|
||||
const summary = manager.trackVerificationRequest(request);
|
||||
|
||||
expect(summary.id).toMatch(/^verification-\d+$/u);
|
||||
expect(summary.methods).toEqual([]);
|
||||
expect(summary.methods).toStrictEqual([]);
|
||||
expect(summary.phaseName).toBe("requested");
|
||||
});
|
||||
|
||||
|
||||
@@ -556,7 +556,7 @@ describe("matrix thread bindings", () => {
|
||||
});
|
||||
|
||||
expect(replacementManager).not.toBe(initialManager);
|
||||
expect(replacementManager.listBindings()).toEqual([]);
|
||||
expect(replacementManager.listBindings()).toStrictEqual([]);
|
||||
expect(
|
||||
getSessionBindingService().resolveByConversation({
|
||||
channel: "matrix",
|
||||
|
||||
@@ -133,7 +133,7 @@ describe("matrix migration snapshots", () => {
|
||||
});
|
||||
expect(detection.inspectorAvailable).toBe(true);
|
||||
expect(detection.plans).toHaveLength(1);
|
||||
expect(detection.warnings).toEqual([]);
|
||||
expect(detection.warnings).toStrictEqual([]);
|
||||
expect(
|
||||
hasActionableMatrixMigration({
|
||||
cfg,
|
||||
|
||||
@@ -62,7 +62,7 @@ describe("splitSignalFormattedText", () => {
|
||||
it("empty text returns empty array", () => {
|
||||
// Empty input produces no chunks (not an empty chunk)
|
||||
const chunks = markdownToSignalTextChunks("", 100);
|
||||
expect(chunks).toEqual([]);
|
||||
expect(chunks).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("text under limit returns single chunk unchanged", () => {
|
||||
|
||||
@@ -18,7 +18,7 @@ describe("markdownToSignalText", () => {
|
||||
const res = markdownToSignalText("see [docs](https://example.com) and https://example.com");
|
||||
|
||||
expect(res.text).toBe("see docs (https://example.com) and https://example.com");
|
||||
expect(res.styles).toEqual([]);
|
||||
expect(res.styles).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("keeps style offsets correct with multiple expanded links", () => {
|
||||
@@ -55,7 +55,7 @@ describe("markdownToSignalText", () => {
|
||||
const res = markdownToSignalText("- one\n- two");
|
||||
|
||||
expect(res.text).toBe("• one\n• two");
|
||||
expect(res.styles).toEqual([]);
|
||||
expect(res.styles).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("uses UTF-16 code units for offsets", () => {
|
||||
|
||||
@@ -33,7 +33,7 @@ describe("signalMessageActions", () => {
|
||||
it("lists actions based on configured accounts and reaction gates", () => {
|
||||
expect(
|
||||
signalMessageActions.describeMessageTool?.({ cfg: {} as OpenClawConfig })?.actions ?? [],
|
||||
).toEqual([]);
|
||||
).toStrictEqual([]);
|
||||
|
||||
expect(
|
||||
signalMessageActions.describeMessageTool?.({
|
||||
|
||||
@@ -106,6 +106,6 @@ describe("sendMessageSignal receipts", () => {
|
||||
});
|
||||
|
||||
expect(result.messageId).toBe("unknown");
|
||||
expect(result.receipt.platformMessageIds).toEqual([]);
|
||||
expect(result.receipt.platformMessageIds).toStrictEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -976,7 +976,7 @@ describe("resolveSlackThreadHistory", () => {
|
||||
limit: 0,
|
||||
});
|
||||
|
||||
expect(result).toEqual([]);
|
||||
expect(result).toStrictEqual([]);
|
||||
expect(replies).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -994,7 +994,7 @@ describe("resolveSlackThreadHistory", () => {
|
||||
limit: 20,
|
||||
});
|
||||
|
||||
expect(result).toEqual([]);
|
||||
expect(result).toStrictEqual([]);
|
||||
expect(vi.mocked(logVerbose)).toHaveBeenCalledWith(
|
||||
expect.stringContaining("slack thread history fetch failed"),
|
||||
);
|
||||
|
||||
@@ -27,7 +27,7 @@ describe("whatsapp setup entry", () => {
|
||||
oauthDir: "/tmp/openclaw-whatsapp-empty",
|
||||
stateDir: "/tmp/openclaw-state",
|
||||
}),
|
||||
).toEqual([]);
|
||||
).toStrictEqual([]);
|
||||
expect(setupEntry.loadLegacySessionSurface?.()).toEqual({
|
||||
canonicalizeLegacySessionKey: expect.any(Function),
|
||||
isLegacyGroupSessionKey: expect.any(Function),
|
||||
|
||||
@@ -35,6 +35,6 @@ describe("trackBackgroundTask", () => {
|
||||
await waitForAsyncCallbacks();
|
||||
|
||||
expect(backgroundTasks.size).toBe(0);
|
||||
expect(unhandledRejections).toEqual([]);
|
||||
expect(unhandledRejections).toStrictEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -202,7 +202,7 @@ describe("createWebOnMessageHandler audio preflight", () => {
|
||||
|
||||
await handler({ ...makeAudioMsg(), accessControlPassed: undefined });
|
||||
|
||||
expect(events).toEqual([]);
|
||||
expect(events).toStrictEqual([]);
|
||||
expect(transcribeFirstAudioMock).not.toHaveBeenCalled();
|
||||
expect(maybeSendAckReactionMock).not.toHaveBeenCalled();
|
||||
expect(processMessageMock).toHaveBeenCalledWith(
|
||||
|
||||
@@ -13,7 +13,7 @@ describe("whatsapp doctor compatibility", () => {
|
||||
});
|
||||
|
||||
expect(result.config.channels?.whatsapp).toBeUndefined();
|
||||
expect(result.changes).toEqual([]);
|
||||
expect(result.changes).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("copies legacy ack reaction into configured whatsapp channel", () => {
|
||||
@@ -69,6 +69,6 @@ describe("whatsapp doctor compatibility", () => {
|
||||
direct: true,
|
||||
group: "always",
|
||||
});
|
||||
expect(result.changes).toEqual([]);
|
||||
expect(result.changes).toStrictEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -275,7 +275,7 @@ describe("createWebSendApi", () => {
|
||||
messageId: "unknown",
|
||||
providerAccepted: false,
|
||||
});
|
||||
expect(res.receipt ? listMessageReceiptPlatformIds(res.receipt) : []).toEqual([]);
|
||||
expect(res.receipt ? listMessageReceiptPlatformIds(res.receipt) : []).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("keeps direct-chat reactions without a participant key", async () => {
|
||||
|
||||
@@ -132,6 +132,6 @@ describe("collectWhatsAppStatusIssues", () => {
|
||||
},
|
||||
]);
|
||||
|
||||
expect(issues).toEqual([]);
|
||||
expect(issues).toStrictEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user