fix(ci): mailer + audit lint + settings Save button collision

Three Go lint hits + two web test failures, all from the U3 push.

- internal/mailer/mailer.go: SentEmail.HtmlBody → HTMLBody (Go's
  initialism convention; revive flagged); FakeSender.Send unused
  ctx parameter renamed to _.
- internal/audit/audit_test.go: removed dead validUUID helper. It
  was added speculatively in U1-T1 and never called by any test.
  pgtype import stays — other tests use it.
- web/src/routes/settings/settings.test.ts: existing ListenBrainz
  tests queried `getByRole('button', { name: /save/i })` which
  worked when the page had only one Save button. The new Profile
  card adds a "Save profile" button that also matches the regex,
  triggering "found multiple elements". Anchored to /^save$/i for
  exact-match. The newer Save profile tests still use
  /save profile/i which is unique.

This is the same shape of test-fixture-lag I owe an answer for: I
landed new content that broke an existing test, and the existing
test had a too-loose selector. The right fix is to tighten the old
selector now (this commit) and to flag this pattern — selectors
that regex-match by partial words — as a candidate for the DRY
pass / test-utils consolidation.
This commit is contained in:
2026-05-07 18:15:22 -04:00
parent 444144038a
commit e4ebc71162
3 changed files with 5 additions and 17 deletions
+2 -2
View File
@@ -64,7 +64,7 @@ describe('Settings page — ListenBrainz', () => {
await waitFor(() =>
expect(screen.getByPlaceholderText(/paste your lb token/i)).toBeInTheDocument()
);
expect(screen.getByRole('button', { name: /save/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /^save$/i })).toBeInTheDocument();
});
test('token-set state renders masked + Clear button', async () => {
@@ -88,7 +88,7 @@ describe('Settings page — ListenBrainz', () => {
render(SettingsPage);
const input = await screen.findByPlaceholderText(/paste your lb token/i);
await fireEvent.input(input, { target: { value: 'mytoken' } });
await fireEvent.click(screen.getByRole('button', { name: /save/i }));
await fireEvent.click(screen.getByRole('button', { name: /^save$/i }));
await waitFor(() => expect(mutateFn).toHaveBeenCalledWith('mytoken', expect.anything()));
});