
























@@ -93,6 +93,8 @@ const LINE_TEST_CFG = {
9393};
94949595describe("LINE send helpers", () => {
96+const fixedSentAt = 1_800_000_000_000;
97+9698beforeAll(async () => {
9799sendModule = await import("./send.js");
98100});
@@ -109,6 +111,7 @@ describe("LINE send helpers", () => {
109111});
110112111113beforeEach(() => {
114+vi.setSystemTime(fixedSentAt);
112115pushMessageMock.mockReset();
113116replyMessageMock.mockReset();
114117showLoadingAnimationMock.mockReset();
@@ -176,8 +179,40 @@ describe("LINE send helpers", () => {
176179direction: "outbound",
177180});
178181expect(logVerboseMock).toHaveBeenCalledWith("line: pushed image to U123");
179-expect(result).toMatchObject({ messageId: "push", chatId: "U123" });
180-expect(result.receipt.primaryPlatformMessageId).toBe("push");
182+expect(result).toEqual({
183+chatId: "U123",
184+messageId: "push",
185+receipt: {
186+parts: [
187+{
188+index: 0,
189+kind: "media",
190+platformMessageId: "push",
191+raw: {
192+channel: "line",
193+chatId: "U123",
194+conversationId: "U123",
195+messageId: "push",
196+meta: { messageCount: 1 },
197+},
198+threadId: "U123",
199+},
200+],
201+platformMessageIds: ["push"],
202+primaryPlatformMessageId: "push",
203+raw: [
204+{
205+channel: "line",
206+chatId: "U123",
207+conversationId: "U123",
208+messageId: "push",
209+meta: { messageCount: 1 },
210+},
211+],
212+sentAt: fixedSentAt,
213+threadId: "U123",
214+},
215+});
181216});
182217183218it("replies when reply token is provided", async () => {
@@ -205,10 +240,40 @@ describe("LINE send helpers", () => {
205240],
206241});
207242expect(logVerboseMock).toHaveBeenCalledWith("line: replied to C1");
208-expect(result).toMatchObject({ messageId: "reply", chatId: "C1" });
209-expect(result.receipt.primaryPlatformMessageId).toBe("reply");
210-expect(result.receipt.threadId).toBe("C1");
211-expect(result.receipt.parts[0]?.kind).toBe("media");
243+expect(result).toEqual({
244+chatId: "C1",
245+messageId: "reply",
246+receipt: {
247+parts: [
248+{
249+index: 0,
250+kind: "media",
251+platformMessageId: "reply",
252+raw: {
253+channel: "line",
254+chatId: "C1",
255+conversationId: "C1",
256+messageId: "reply",
257+meta: { messageCount: 2 },
258+},
259+threadId: "C1",
260+},
261+],
262+platformMessageIds: ["reply"],
263+primaryPlatformMessageId: "reply",
264+raw: [
265+{
266+channel: "line",
267+chatId: "C1",
268+conversationId: "C1",
269+messageId: "reply",
270+meta: { messageCount: 2 },
271+},
272+],
273+sentAt: fixedSentAt,
274+threadId: "C1",
275+},
276+});
212277});
213278214279it("sends video with explicit image preview URL", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。