refactor(line): share source info parsing

This commit is contained in:
Peter Steinberger
2026-02-15 16:57:58 +00:00
parent c906121ad3
commit 1ab5fcc325
3 changed files with 18 additions and 26 deletions

View File

@@ -45,6 +45,17 @@ const { buildLineMessageContextMock, buildLinePostbackContextMock } = vi.hoisted
vi.mock("./bot-message-context.js", () => ({
buildLineMessageContext: (...args: unknown[]) => buildLineMessageContextMock(...args),
buildLinePostbackContext: (...args: unknown[]) => buildLinePostbackContextMock(...args),
getLineSourceInfo: (source: {
type?: string;
userId?: string;
groupId?: string;
roomId?: string;
}) => ({
userId: source.userId,
groupId: source.type === "group" ? source.groupId : undefined,
roomId: source.type === "room" ? source.roomId : undefined,
isGroup: source.type === "group" || source.type === "room",
}),
}));
const { readAllowFromStoreMock, upsertPairingRequestMock } = vi.hoisted(() => ({