























@@ -146,48 +146,72 @@ describe.each(storeFactories)("msteams conversation store ($name)", ({ createSto
146146it("preserves existing timezone when upsert omits timezone", async () => {
147147const store = await createStore();
148148149-await store.upsert("conv-tz", {
150-conversation: { id: "conv-tz" },
151-channelId: "msteams",
152-serviceUrl: "https://service.example.com",
153-user: { id: "u1" },
154-timezone: "Europe/London",
155-});
149+vi.useFakeTimers();
150+try {
151+vi.setSystemTime(new Date("2026-03-25T20:00:00.000Z"));
152+await store.upsert("conv-tz", {
153+conversation: { id: "conv-tz" },
154+channelId: "msteams",
155+serviceUrl: "https://service.example.com",
156+user: { id: "u1" },
157+timezone: "Europe/London",
158+});
156159157-await store.upsert("conv-tz", {
158-conversation: { id: "conv-tz" },
159-channelId: "msteams",
160-serviceUrl: "https://service.example.com",
161-user: { id: "u1" },
162-});
160+vi.setSystemTime(new Date("2026-03-25T20:01:00.000Z"));
161+await store.upsert("conv-tz", {
162+conversation: { id: "conv-tz" },
163+channelId: "msteams",
164+serviceUrl: "https://service.example.com",
165+user: { id: "u1" },
166+});
163167164-await expect(store.get("conv-tz")).resolves.toMatchObject({
165-timezone: "Europe/London",
166-});
168+await expect(store.get("conv-tz")).resolves.toEqual({
169+conversation: { id: "conv-tz" },
170+channelId: "msteams",
171+serviceUrl: "https://service.example.com",
172+user: { id: "u1" },
173+timezone: "Europe/London",
174+lastSeenAt: "2026-03-25T20:01:00.000Z",
175+});
176+} finally {
177+vi.useRealTimers();
178+}
167179});
168180169181it("preserves graphChatId across upserts that omit it", async () => {
170182const store = await createStore();
171183172-await store.upsert("conv-graph", {
173-conversation: { id: "conv-graph", conversationType: "personal" },
174-channelId: "msteams",
175-serviceUrl: "https://service.example.com",
176-user: { id: "u1" },
177-graphChatId: "19:resolved-chat-id@unq.gbl.spaces",
178-});
184+vi.useFakeTimers();
185+try {
186+vi.setSystemTime(new Date("2026-03-25T20:00:00.000Z"));
187+await store.upsert("conv-graph", {
188+conversation: { id: "conv-graph", conversationType: "personal" },
189+channelId: "msteams",
190+serviceUrl: "https://service.example.com",
191+user: { id: "u1" },
192+graphChatId: "19:resolved-chat-id@unq.gbl.spaces",
193+});
179194180-// Second upsert without graphChatId (normal activity-based upsert)
181-await store.upsert("conv-graph", {
182-conversation: { id: "conv-graph", conversationType: "personal" },
183-channelId: "msteams",
184-serviceUrl: "https://service.example.com",
185-user: { id: "u1" },
186-});
195+vi.setSystemTime(new Date("2026-03-25T20:01:00.000Z"));
196+// Second upsert without graphChatId (normal activity-based upsert)
197+await store.upsert("conv-graph", {
198+conversation: { id: "conv-graph", conversationType: "personal" },
199+channelId: "msteams",
200+serviceUrl: "https://service.example.com",
201+user: { id: "u1" },
202+});
187203188-await expect(store.get("conv-graph")).resolves.toMatchObject({
189-graphChatId: "19:resolved-chat-id@unq.gbl.spaces",
190-});
204+await expect(store.get("conv-graph")).resolves.toEqual({
205+conversation: { id: "conv-graph", conversationType: "personal" },
206+channelId: "msteams",
207+serviceUrl: "https://service.example.com",
208+user: { id: "u1" },
209+graphChatId: "19:resolved-chat-id@unq.gbl.spaces",
210+lastSeenAt: "2026-03-25T20:01:00.000Z",
211+});
212+} finally {
213+vi.useRealTimers();
214+}
191215});
192216193217it("prefers the freshest personal conversation for repeated upserts of the same user", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。