From 4ce1ef01024a1bc15c9b9c2bbc2d3d9ae43d465c Mon Sep 17 00:00:00 2001 From: yosoyepa Date: Fri, 15 May 2026 16:49:50 -0500 Subject: [PATCH] test(frontend): cover missing and null record branches in ContextMenus - Assert LoveButton is hidden (visible=false) when record.missing is true in both AlbumContextMenu and ArtistContextMenu - Assert both menus render nothing when record is undefined, exercising the early-return branch Co-Authored-By: Claude Opus 4.7 (1M context) --- ui/src/common/ContextMenus.test.jsx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ui/src/common/ContextMenus.test.jsx b/ui/src/common/ContextMenus.test.jsx index 787e30805..45917556c 100644 --- a/ui/src/common/ContextMenus.test.jsx +++ b/ui/src/common/ContextMenus.test.jsx @@ -67,6 +67,17 @@ describe('AlbumContextMenu', () => { render() expect(capturedLoveButtonProps.resource).toBe('album') }) + + it('hides LoveButton when record.missing is true', () => { + render() + expect(capturedLoveButtonProps.visible).toBe(false) + expect(screen.queryByTestId('love-button')).not.toBeInTheDocument() + }) + + it('renders nothing when record is undefined', () => { + const { container } = render() + expect(container).toBeEmptyDOMElement() + }) }) describe('ArtistContextMenu', () => { @@ -96,4 +107,15 @@ describe('ArtistContextMenu', () => { render() expect(capturedLoveButtonProps.resource).toBe('artist') }) + + it('hides LoveButton when record.missing is true', () => { + render() + expect(capturedLoveButtonProps.visible).toBe(false) + expect(screen.queryByTestId('love-button')).not.toBeInTheDocument() + }) + + it('renders nothing when record is undefined', () => { + const { container } = render() + expect(container).toBeEmptyDOMElement() + }) })