diff --git a/plugins/thread-list/app/list/useSidebarThreadReveal.test.ts b/plugins/thread-list/app/list/useSidebarThreadReveal.test.ts index 2627dae21..cfe5ec0a4 100644 --- a/plugins/thread-list/app/list/useSidebarThreadReveal.test.ts +++ b/plugins/thread-list/app/list/useSidebarThreadReveal.test.ts @@ -53,6 +53,35 @@ function startReveal( } describe("useSidebarThreadReveal", () => { + it("does not reveal a background thread when it arrives or becomes unread", () => { + const { reveal } = startReveal({ threads: [thread("first")] }); + + expect( + reveal({ + threads: [ + thread("first"), + thread("background", { latestAttentionAt: 2 }), + ], + }), + ).toEqual([]); + + expect( + reveal({ threads: [thread("first"), thread("background")] }), + ).toEqual([]); + expect( + reveal({ + threads: [ + thread("first"), + thread("background", { latestAttentionAt: 3 }), + ], + }), + ).toEqual([]); + + expect(reveal({ selectedThreadId: "background" })).toEqual([ + "background", + ]); + }); + it("requires leaving and returning before revealing the open thread again", () => { const { initial, reveal } = startReveal({ threads: [thread("first"), thread("second")],