fix(ui): format artwork files, drop unused i18n keys, harden test assertions

This commit is contained in:
Deluan 2026-09-03 23:38:15 -04:00
commit eadbb442a8
3 changed files with 17 additions and 19 deletions

View file

@ -1,11 +1,6 @@
import React, { useEffect, useState } from 'react'
import PropTypes from 'prop-types'
import {
Chip,
Link,
TableCell,
TableRow,
} from '@material-ui/core'
import { Chip, Link, TableCell, TableRow } from '@material-ui/core'
import { makeStyles } from '@material-ui/core/styles'
import { useDataProvider, usePermissions, useTranslate } from 'react-admin'
@ -112,9 +107,7 @@ export const ArtworkInfo = ({ resource, id }) => {
<Row label={translate('artwork.result')}>{report.result}</Row>
{recorded ? (
<>
<Row label={translate('artwork.source')}>
{report.stored?.source}
</Row>
<Row label={translate('artwork.source')}>{report.stored?.source}</Row>
<Row label={translate('artwork.attemptedAt')}>
{report.stored?.attemptedAt}
</Row>
@ -131,7 +124,9 @@ export const ArtworkInfo = ({ resource, id }) => {
className={classes.toggle}
onClick={() => setExpanded(!expanded)}
>
{translate(expanded ? 'artwork.hideDetails' : 'artwork.showDetails')}
{translate(
expanded ? 'artwork.hideDetails' : 'artwork.showDetails',
)}
</Link>
</TableCell>
</TableRow>

View file

@ -25,7 +25,11 @@ const report = {
stored: { source: 'external:deezer', attemptedAt: '2026-09-01T10:00:00Z' },
steps: [
{ candidate: 'cover.*', outcome: 'miss' },
{ candidate: 'external:deezer', outcome: 'hit', detail: 'https://cdn/x.jpg' },
{
candidate: 'external:deezer',
outcome: 'hit',
detail: 'https://cdn/x.jpg',
},
],
config: { setting: 'ArtistArtPriority', value: 'external' },
}
@ -69,9 +73,7 @@ describe('<ArtworkInfo />', () => {
await screen.findByText('resolved from external:deezer')
await userEvent.click(screen.getByText('artwork.showDetails'))
expect(screen.getByText('cover.*')).toBeInTheDocument()
expect(
screen.getByText('ArtistArtPriority', { exact: false }),
).toBeInTheDocument()
expect(screen.getByText('ArtistArtPriority:')).toBeInTheDocument()
})
it('shows the not-recorded state', async () => {
@ -80,6 +82,12 @@ describe('<ArtworkInfo />', () => {
})
renderInTable(<ArtworkInfo resource="artist" id="ar-1" />)
expect(await screen.findByText('artwork.notRecorded')).toBeInTheDocument()
// stored/queued/config/agents are all omitted by the endpoint here, so the optional
// blocks' guards must not throw when expanded.
await userEvent.click(screen.getByText('artwork.showDetails'))
expect(screen.queryByText('artwork.priority')).toBeNull()
expect(screen.queryByText('artwork.agents')).toBeNull()
})
it('renders nothing when the fetch fails', async () => {

View file

@ -654,16 +654,11 @@
"attemptedAt": "Attempted at",
"showDetails": "Show details",
"hideDetails": "Hide details",
"candidate": "Candidate",
"outcome": "Outcome",
"detail": "Detail",
"queue": "Queue",
"priority": "Priority",
"attempts": "Attempts",
"retryAt": "Retry at",
"lastAttemptFailed": "Last attempt failed",
"gaveUpAfter": "Gave up after",
"config": "Config",
"agents": "Agents",
"notRecorded": "No resolution recorded yet"
},