





















@@ -2246,10 +2246,11 @@ describe("matrix live qa scenarios", () => {
22462246it("preserves separate finalized block events when Matrix block streaming is enabled", async () => {
22472247const primeRoom = vi.fn().mockResolvedValue("driver-sync-start");
22482248const sendTextMessage = vi.fn().mockResolvedValue("$block-stream-trigger");
2249-const readBlockText = (label: "First" | "Second") =>
2250-new RegExp(`${label} exact marker: \`([^\\\`]+)\``).exec(
2251-String(sendTextMessage.mock.calls[0]?.[0]?.body),
2252-)?.[1] ?? `MATRIX_QA_BLOCK_${label.toUpperCase()}_FIXED`;
2249+const readBlockText = (label: "ONE" | "TWO") =>
2250+String(sendTextMessage.mock.calls[0]?.[0]?.body)
2251+.split("\n")
2252+.find((line) => line.startsWith(`MATRIX_QA_BLOCK_${label}_`)) ??
2253+`MATRIX_QA_BLOCK_${label}_FIXED`;
22532254const waitForRoomEvent = vi
22542255.fn()
22552256.mockImplementationOnce(async () => ({
@@ -2259,7 +2260,7 @@ describe("matrix live qa scenarios", () => {
22592260eventId: "$block-one",
22602261sender: "@sut:matrix-qa.test",
22612262type: "m.room.message",
2262-body: readBlockText("First"),
2263+body: readBlockText("ONE"),
22632264},
22642265since: "driver-sync-block-one",
22652266}))
@@ -2270,7 +2271,7 @@ describe("matrix live qa scenarios", () => {
22702271eventId: "$block-two",
22712272sender: "@sut:matrix-qa.test",
22722273type: "m.room.message",
2273-body: readBlockText("Second"),
2274+body: readBlockText("TWO"),
22742275},
22752276since: "driver-sync-next",
22762277}));
@@ -2333,6 +2334,10 @@ describe("matrix live qa scenarios", () => {
23332334mentionUserIds: ["@sut:matrix-qa.test"],
23342335roomId: "!block:matrix-qa.test",
23352336});
2337+const body = String(sendTextMessage.mock.calls[0]?.[0]?.body);
2338+expect(body).toMatch(
2339+/reply with exactly this two-line body and no extra text:\nMATRIX_QA_BLOCK_ONE_[A-F0-9]{8}\nMATRIX_QA_BLOCK_TWO_[A-F0-9]{8}$/,
2340+);
23362341expect(waitForRoomEvent).toHaveBeenNthCalledWith(
233723422,
23382343expect.objectContaining({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。