From eadbb442a8c42978ec9a8795345800e3affc23cf Mon Sep 17 00:00:00 2001 From: Deluan Date: Thu, 3 Sep 2026 23:38:15 -0400 Subject: [PATCH] fix(ui): format artwork files, drop unused i18n keys, harden test assertions --- ui/src/common/ArtworkInfo.jsx | 15 +++++---------- ui/src/common/ArtworkInfo.test.jsx | 16 ++++++++++++---- ui/src/i18n/en.json | 5 ----- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/ui/src/common/ArtworkInfo.jsx b/ui/src/common/ArtworkInfo.jsx index 42eb0c699..b83fc71b6 100644 --- a/ui/src/common/ArtworkInfo.jsx +++ b/ui/src/common/ArtworkInfo.jsx @@ -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 }) => { {report.result} {recorded ? ( <> - - {report.stored?.source} - + {report.stored?.source} {report.stored?.attemptedAt} @@ -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', + )} diff --git a/ui/src/common/ArtworkInfo.test.jsx b/ui/src/common/ArtworkInfo.test.jsx index 2a793911a..862881939 100644 --- a/ui/src/common/ArtworkInfo.test.jsx +++ b/ui/src/common/ArtworkInfo.test.jsx @@ -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('', () => { 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('', () => { }) renderInTable() 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 () => { diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json index e733dfeba..9635cadd1 100644 --- a/ui/src/i18n/en.json +++ b/ui/src/i18n/en.json @@ -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" },