fix(server,web): forward-fix CI lint + vitest failures
- gofmt -s on system.go, system_cron.go, api.go - rename unused r → _ in 3 fetcher_test.go HTTP handlers - TrackRow +queue test uses /add .* to queue/i (track-aware aria-label from #377) - /library/artists page test mocks likes + tanstack-query (ArtistCard now embeds LikeButton) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -95,7 +95,7 @@ describe('TrackRow', () => {
|
||||
|
||||
test('+ queue button calls enqueueTrack and does NOT trigger row play', async () => {
|
||||
render(TrackRow, { props: { tracks, index: 0 } });
|
||||
await fireEvent.click(screen.getByRole('button', { name: /add to queue/i }));
|
||||
await fireEvent.click(screen.getByRole('button', { name: /add .* to queue/i }));
|
||||
expect(enqueueTrack).toHaveBeenCalledWith(tracks[0]);
|
||||
expect(playQueue).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -20,7 +20,23 @@ vi.mock('$lib/api/queries', () => ({
|
||||
})
|
||||
}));
|
||||
vi.mock('$lib/api/client', () => ({ api: { get: vi.fn() } }));
|
||||
vi.mock('$lib/player/store.svelte', () => ({ playQueue: vi.fn() }));
|
||||
vi.mock('$lib/player/store.svelte', () => ({
|
||||
playQueue: vi.fn(),
|
||||
enqueueTracks: vi.fn()
|
||||
}));
|
||||
vi.mock('$lib/api/artists', () => ({
|
||||
listArtistTracks: vi.fn().mockResolvedValue([])
|
||||
}));
|
||||
vi.mock('$lib/api/likes', () => ({
|
||||
createLikedIdsQuery: () =>
|
||||
readable({ data: { track_ids: [], album_ids: [], artist_ids: [] }, isPending: false, isError: false }),
|
||||
likeEntity: vi.fn().mockResolvedValue(undefined),
|
||||
unlikeEntity: vi.fn().mockResolvedValue(undefined)
|
||||
}));
|
||||
vi.mock('@tanstack/svelte-query', async (orig) => {
|
||||
const actual = (await orig()) as Record<string, unknown>;
|
||||
return { ...actual, useQueryClient: () => ({ invalidateQueries: vi.fn() }) };
|
||||
});
|
||||
|
||||
import Page from './+page.svelte';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user