fix: hide navidrome link when webUrl is null (cleared subsonic url)
This commit is contained in:
@@ -108,7 +108,7 @@ export default function ItemPage() {
|
||||
</p>
|
||||
)}
|
||||
|
||||
{item.matchedAlbum && (
|
||||
{item.matchedAlbum?.webUrl && (
|
||||
<a
|
||||
href={item.matchedAlbum.webUrl}
|
||||
target="_blank"
|
||||
|
||||
@@ -72,7 +72,7 @@ export interface MatchedAlbum {
|
||||
id: number
|
||||
subsonicId: string
|
||||
lastPlayedAt: string | null
|
||||
webUrl: string
|
||||
webUrl: string | null
|
||||
}
|
||||
export interface Stats {
|
||||
totals: { items: number; ripped: number; notRipped: number; onLoan: number }
|
||||
|
||||
@@ -200,6 +200,17 @@ describe('ItemPage', () => {
|
||||
expect(screen.queryByRole('link', { name: /listen in navidrome/i })).toBeNull()
|
||||
})
|
||||
|
||||
it('link hidden when the subsonic url was cleared (webUrl null)', async () => {
|
||||
vi.mocked(api.getItem).mockResolvedValue({
|
||||
...item,
|
||||
ripStatus: 'ripped',
|
||||
matchedAlbum: { id: 77, subsonicId: 'alb-1', lastPlayedAt: null, webUrl: null },
|
||||
} as never)
|
||||
renderItem()
|
||||
await waitFor(() => expect(screen.getByRole('heading', { name: 'Motion' })).toBeTruthy())
|
||||
expect(screen.queryByRole('link', { name: /listen in navidrome/i })).toBeNull()
|
||||
})
|
||||
|
||||
it('shows last played under the rip banner', async () => {
|
||||
vi.mocked(api.getItem).mockResolvedValue(rippedItem as never)
|
||||
renderItem()
|
||||
|
||||
Reference in New Issue
Block a user