From df98c159e9dc10fac2e58ee161471bcf5d17d389 Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Mon, 9 Nov 2026 17:46:13 -0800 Subject: [PATCH] test(source-control): cover collapsed folder card identity --- .../FolderWorkspaceSourceControlPanel.test.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/renderer/src/components/right-sidebar/FolderWorkspaceSourceControlPanel.test.tsx b/src/renderer/src/components/right-sidebar/FolderWorkspaceSourceControlPanel.test.tsx index 34290b57abf..6f2969d4982 100644 --- a/src/renderer/src/components/right-sidebar/FolderWorkspaceSourceControlPanel.test.tsx +++ b/src/renderer/src/components/right-sidebar/FolderWorkspaceSourceControlPanel.test.tsx @@ -158,17 +158,21 @@ async function render(visible = true) { ) } -it('labels same-repo sections by worktree name and a detached section by its HEAD', async () => { +it('identifies same-repo cards by name and shows their branch when collapsed', async () => { const [onBranch, detached] = setup(2) useAppStore.setState({ worktreesByRepo: { repo: [onBranch!, { ...detached!, branch: '', head: 'abc1234def' }] } }) await render() - expect( - [...container.querySelectorAll('section button[aria-expanded]')].map( - (toggle) => toggle.textContent - ) - ).toEqual(['ChildChild 0feature-0', 'ChildChild 1Detached HEAD · abc1234']) + const toggles = [ + ...container.querySelectorAll('section button[aria-expanded]') + ] + expect(toggles.map((toggle) => toggle.textContent)).toEqual(['ChildChild 0', 'ChildChild 1']) + await act(async () => toggles.forEach((toggle) => toggle.click())) + expect([...container.querySelectorAll('section')].map((section) => section.textContent)).toEqual([ + 'ChildChild 0feature-0', + 'ChildChild 1Detached HEAD · abc1234' + ]) }) function ScopedStatusObserver({ owner }: { owner: SourceControlScope }) {