fix(msteams): preserve timezone on memory upsert

This commit is contained in:
Tak Hoffman
2026-03-26 20:54:25 -05:00
parent 708b9339a5
commit 5404b0eaa6
2 changed files with 28 additions and 1 deletions

View File

@@ -184,4 +184,27 @@ describe("msteams conversation store (memory)", () => {
await expect(store.get("conv-a")).resolves.toBeNull();
await expect(store.remove("missing")).resolves.toBe(false);
});
it("preserves existing timezone when upsert omits timezone, matching the fs store", async () => {
const store = createMSTeamsConversationStoreMemory();
await store.upsert("conv-tz", {
conversation: { id: "conv-tz" },
channelId: "msteams",
serviceUrl: "https://service.example.com",
user: { id: "u1" },
timezone: "Europe/London",
});
await store.upsert("conv-tz", {
conversation: { id: "conv-tz" },
channelId: "msteams",
serviceUrl: "https://service.example.com",
user: { id: "u1" },
});
await expect(store.get("conv-tz")).resolves.toMatchObject({
timezone: "Europe/London",
});
});
});

View File

@@ -14,7 +14,11 @@ export function createMSTeamsConversationStoreMemory(
return {
upsert: async (conversationId, reference) => {
map.set(conversationId, reference);
const existing = map.get(conversationId);
map.set(conversationId, {
...(existing?.timezone && !reference.timezone ? { timezone: existing.timezone } : {}),
...reference,
});
},
get: async (conversationId) => {
return map.get(conversationId) ?? null;