diff --git a/apps/web/src/j5/sharing/sharedTimeline.browser.test.tsx b/apps/web/src/j5/sharing/sharedTimeline.browser.test.tsx index 807b90b484dd6..53ea2a920c876 100644 --- a/apps/web/src/j5/sharing/sharedTimeline.browser.test.tsx +++ b/apps/web/src/j5/sharing/sharedTimeline.browser.test.tsx @@ -73,10 +73,14 @@ describe("useSharedConversationEntries", () => { seen.push(useSharedConversationEntries(threadRef, entries)); return {props.tick}; } + // The message is first seen a millisecond before the thread is shared; on the wall clock both + // renders can fall in the same millisecond, which reads as seen once it may be shared. + using now = vi.spyOn(Date, "now").mockReturnValue(10); // The hook reads no route. await using screen = await render(, { router: false }); expect(authors.refresh).not.toHaveBeenCalled(); reach.people = twoWriters; + now.mockReturnValue(11); await screen.rerender(); expect(seen.at(-1)?.map((entry) => entry.id)).toEqual(["entry-1"]); expect(authors.refresh).toHaveBeenCalledTimes(1);