web: Vitest after svelte-query 6; spaces that Svelte trimmed out of four labels (#8532)
release / go (push) Successful in 1m55s
release / web (push) Successful in 1m25s
release / govulncheck (push) Successful in 17s
release / integration (push) Successful in 2m40s
release / android (push) Successful in 2m6s
release / Build signed APK (push) Successful in 2m0s
release / Build + push container image (push) Successful in 37s

Run 11484 failed 18 Vitest tests in 7 files:
- Two tests still mocked a query as a hand-written store ({ subscribe }).
  They now mock a plain query object.
- TrackMenu now creates its hidden-tracks query when it mounts, not lazily
  as the old $derived store did, so page tests that render track rows mock
  #lib/api/quarantine like the component tests already did.
- The tuning trends headers read "Plays(window)". Svelte drops the
  leading space inside <span> (window)</span>, and jsdom 31 no longer
  hides that. The same gluing showed in:
  - "Title· File missing" on track rows;
  - the track position on Suspect sources;
  - the screen-reader "(new)" on notifications.
  Each space now sits outside the span, or is an expression Svelte keeps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-04 14:09:20 -05:00
co-authored by Claude Opus 5.5
parent 72e8702e53
commit feef626ba5
11 changed files with 32 additions and 24 deletions
@@ -144,7 +144,7 @@
class="block text-sm {looksNew(item) ? 'font-medium text-text-primary' : 'text-text-secondary'}"
>
{item.title}
{#if looksNew(item)}<span class="sr-only"> (new)</span>{/if}
{#if looksNew(item)}<span class="sr-only">{' '}(new)</span>{/if}
</span>
{#if item.body}
<span class="block text-sm text-text-secondary">{item.body}</span>
@@ -97,7 +97,7 @@
{#snippet note()}
{#if isMissingFile}
<span class="text-error-fg"> · File missing</span>
<span class="text-error-fg">{' '}· File missing</span>
{/if}
{/snippet}
@@ -11,9 +11,10 @@ const metricsMock = vi.hoisted(() => ({
vi.mock('#lib/api/metrics.js', () => ({
createRecommendationMetricsQuery: () => ({
subscribe: (run: (v: unknown) => void) => {
run({ isPending: false, isError: false, data: metricsMock.data });
return () => {};
isPending: false,
isError: false,
get data() {
return metricsMock.data;
}
})
}));
+1 -1
View File
@@ -101,7 +101,7 @@
{#snippet note()}
{#if missing}
<span class="text-error-fg"> · File missing</span>
<span class="text-error-fg">{' '}· File missing</span>
{/if}
{/snippet}
</TrackListRow>
+4 -4
View File
@@ -338,10 +338,10 @@
<tr class="text-left text-text-secondary">
<th class="py-1 font-medium">Surface</th>
<th class="py-1 font-medium">Skip rate, last {t.weeks} weeks</th>
<th class="py-1 text-right font-medium">Plays<span class="font-normal text-xs"> (window)</span></th>
<th class="py-1 text-right font-medium">Skip<span class="font-normal text-xs"> (last wk)</span></th>
<th class="py-1 text-right font-medium">Completion<span class="font-normal text-xs"> (last wk)</span></th>
<th class="py-1 text-right font-medium">Taste hit<span class="font-normal text-xs"> (window)</span></th>
<th class="py-1 text-right font-medium">Plays <span class="font-normal text-xs">(window)</span></th>
<th class="py-1 text-right font-medium">Skip <span class="font-normal text-xs">(last wk)</span></th>
<th class="py-1 text-right font-medium">Completion <span class="font-normal text-xs">(last wk)</span></th>
<th class="py-1 text-right font-medium">Taste hit <span class="font-normal text-xs">(window)</span></th>
</tr>
</thead>
<tbody>
+3
View File
@@ -3,6 +3,7 @@ import { render, screen } from '@testing-library/svelte';
import { flushSync } from 'svelte';
import { mockQuery } from '../../../test-utils/query';
import { emptyLikesMock } from '../../../test-utils/mocks/likes';
import { emptyQuarantineMock } from '../../../test-utils/mocks/quarantine';
import type { AlbumDetail, TrackRef } from '#lib/api/types.js';
import { makeTrack } from '#test-utils/fixtures/track.js';
@@ -21,6 +22,8 @@ vi.mock('#lib/api/queries.js', () => ({
}));
vi.mock('#lib/api/likes.js', () => emptyLikesMock());
// Track rows render TrackMenu, which reads the hidden-tracks query on mount.
vi.mock('#lib/api/quarantine.js', () => emptyQuarantineMock());
import AlbumPage from './+page.svelte';
import { createAlbumQuery } from '#lib/api/queries.js';
@@ -3,6 +3,7 @@ import { render, screen, fireEvent, waitFor } from '@testing-library/svelte';
import { flushSync } from 'svelte';
import { mockQuery } from '../../../test-utils/query';
import { emptyLikesMock } from '../../../test-utils/mocks/likes';
import { emptyQuarantineMock } from '../../../test-utils/mocks/quarantine';
import { apiClientMock } from '../../../test-utils/mocks/client';
import { makeTracks } from '#test-utils/fixtures/track.js';
import type { ArtistDetail, AlbumRef } from '#lib/api/types.js';
@@ -24,6 +25,8 @@ vi.mock('#lib/api/queries.js', () => ({
}));
vi.mock('#lib/api/likes.js', () => emptyLikesMock());
// Track rows render TrackMenu, which reads the hidden-tracks query on mount.
vi.mock('#lib/api/quarantine.js', () => emptyQuarantineMock());
vi.mock('#lib/api/client.js', () => apiClientMock());
@@ -166,7 +166,7 @@
{t.artist_name} ·
<a href="/albums/{t.album_id}" class="hover:text-text-primary hover:underline"
>{t.album_title}</a
>{#if position(t)}<span class="text-text-muted"> · {position(t)}</span>{/if}
>{#if position(t)}<span class="text-text-muted">{' '}· {position(t)}</span>{/if}
</div>
<!-- The file name is the evidence; the markers are read from it. -->
<div class="truncate font-mono text-xs text-text-muted" title={t.file_path}>
@@ -28,8 +28,6 @@ vi.mock('#lib/api/history.js', async () => {
return {
...actual,
createHistoryQuery: () => ({
subscribe: (run: (v: unknown) => void) => {
run({
data: mockData,
isPending: mockIsPending,
isError: mockIsError,
@@ -38,9 +36,6 @@ vi.mock('#lib/api/history.js', async () => {
isFetchingNextPage: mockIsFetchingNextPage,
fetchNextPage: mockFetchNextPage,
refetch: mockRefetch
});
return () => {};
}
})
};
});
@@ -2,6 +2,7 @@ import { afterEach, describe, expect, test, vi } from 'vitest';
import { render, screen, fireEvent } from '@testing-library/svelte';
import { mockInfiniteQuery } from '../../../test-utils/query';
import { apiClientMock } from '../../../test-utils/mocks/client';
import { emptyQuarantineMock } from '../../../test-utils/mocks/quarantine';
import type { ArtistRef, AlbumRef, TrackRef, Page } from '#lib/api/types.js';
import { makeTrack } from '#test-utils/fixtures/track.js';
import { page } from '#test-utils/fixtures/page.js';
@@ -20,6 +21,8 @@ vi.mock('#lib/api/likes.js', () => ({
}));
vi.mock('#lib/api/client.js', () => apiClientMock());
// Track rows render TrackMenu, which reads the hidden-tracks query on mount.
vi.mock('#lib/api/quarantine.js', () => emptyQuarantineMock());
vi.mock('#lib/player/store.svelte.js', () => ({
playQueue: vi.fn(), enqueueTrack: vi.fn(), enqueueTracks: vi.fn(), playRadio: vi.fn(),
player: { current: undefined }
+3
View File
@@ -2,6 +2,7 @@ import { afterEach, describe, expect, test, vi } from 'vitest';
import { render, screen } from '@testing-library/svelte';
import { mockQuery } from '../../test-utils/query';
import { emptyLikesMock } from '../../test-utils/mocks/likes';
import { emptyQuarantineMock } from '../../test-utils/mocks/quarantine';
import { apiClientMock } from '../../test-utils/mocks/client';
import { pageUrlModule } from '#test-utils/mocks/appState.js';
import type { ArtistRef, AlbumRef, SearchResponse } from '#lib/api/types.js';
@@ -28,6 +29,8 @@ vi.mock('#lib/player/store.svelte.js', () => ({
vi.mock('#lib/api/client.js', () => apiClientMock());
vi.mock('#lib/api/likes.js', () => emptyLikesMock());
// Track rows render TrackMenu, which reads the hidden-tracks query on mount.
vi.mock('#lib/api/quarantine.js', () => emptyQuarantineMock());
import SearchPage from './+page.svelte';
import { createSearchQuery } from '#lib/api/queries.js';