mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-29 20:05:03 +00:00
refactor: extract iMessage echo cache and unify suppression guards
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { __testing } from "./monitor-provider.js";
|
||||
import { createSentMessageCache } from "./echo-cache.js";
|
||||
|
||||
describe("iMessage sent-message echo cache", () => {
|
||||
afterEach(() => {
|
||||
@@ -9,7 +9,7 @@ describe("iMessage sent-message echo cache", () => {
|
||||
it("matches recent text within the same scope", () => {
|
||||
vi.useFakeTimers();
|
||||
vi.setSystemTime(new Date("2026-02-25T00:00:00Z"));
|
||||
const cache = __testing.createSentMessageCache();
|
||||
const cache = createSentMessageCache();
|
||||
|
||||
cache.remember("acct:imessage:+1555", { text: " Reasoning:\r\n_step_ " });
|
||||
|
||||
@@ -20,7 +20,7 @@ describe("iMessage sent-message echo cache", () => {
|
||||
it("matches by outbound message id and ignores placeholder ids", () => {
|
||||
vi.useFakeTimers();
|
||||
vi.setSystemTime(new Date("2026-02-25T00:00:00Z"));
|
||||
const cache = __testing.createSentMessageCache();
|
||||
const cache = createSentMessageCache();
|
||||
|
||||
cache.remember("acct:imessage:+1555", { messageId: "abc-123" });
|
||||
cache.remember("acct:imessage:+1555", { messageId: "ok" });
|
||||
@@ -32,7 +32,7 @@ describe("iMessage sent-message echo cache", () => {
|
||||
it("keeps message-id lookups longer than text fallback", () => {
|
||||
vi.useFakeTimers();
|
||||
vi.setSystemTime(new Date("2026-02-25T00:00:00Z"));
|
||||
const cache = __testing.createSentMessageCache();
|
||||
const cache = createSentMessageCache();
|
||||
|
||||
cache.remember("acct:imessage:+1555", { text: "hello", messageId: "m-1" });
|
||||
vi.advanceTimersByTime(6000);
|
||||
|
||||
Reference in New Issue
Block a user