mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-01 07:21:17 +00:00
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) <noreply@anthropic.com>
This commit is contained in:
parent
9d8e680451
commit
4ce1ef0102
@ -67,6 +67,17 @@ describe('AlbumContextMenu', () => {
|
||||
render(<AlbumContextMenu record={albumRecord} />)
|
||||
expect(capturedLoveButtonProps.resource).toBe('album')
|
||||
})
|
||||
|
||||
it('hides LoveButton when record.missing is true', () => {
|
||||
render(<AlbumContextMenu record={{ ...albumRecord, missing: true }} />)
|
||||
expect(capturedLoveButtonProps.visible).toBe(false)
|
||||
expect(screen.queryByTestId('love-button')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('renders nothing when record is undefined', () => {
|
||||
const { container } = render(<AlbumContextMenu />)
|
||||
expect(container).toBeEmptyDOMElement()
|
||||
})
|
||||
})
|
||||
|
||||
describe('ArtistContextMenu', () => {
|
||||
@ -96,4 +107,15 @@ describe('ArtistContextMenu', () => {
|
||||
render(<ArtistContextMenu record={artistRecord} />)
|
||||
expect(capturedLoveButtonProps.resource).toBe('artist')
|
||||
})
|
||||
|
||||
it('hides LoveButton when record.missing is true', () => {
|
||||
render(<ArtistContextMenu record={{ ...artistRecord, missing: true }} />)
|
||||
expect(capturedLoveButtonProps.visible).toBe(false)
|
||||
expect(screen.queryByTestId('love-button')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('renders nothing when record is undefined', () => {
|
||||
const { container } = render(<ArtistContextMenu />)
|
||||
expect(container).toBeEmptyDOMElement()
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user