2357df83be
Pre-sweep checkpoint. Adds: - fixtures/track.ts — makeTrack() / makeTracks(n) (18 files duplicate today) - mocks/likes.ts — emptyLikesMock() (19 files duplicate today) - mocks/quarantine.ts — emptyQuarantineMock() (9 files duplicate today) - mocks/appState.ts — pageUrlModule(state) (8 files duplicate today) The sweep commits that follow update test files to use these helpers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
26 lines
757 B
TypeScript
26 lines
757 B
TypeScript
// Default empty-LikedIds mock for $lib/api/likes. Mirrors the
|
|
// TanStack Query readable shape (data + isPending + isError) that
|
|
// 19 test files were duplicating verbatim.
|
|
//
|
|
// Usage:
|
|
// vi.mock('$lib/api/likes', () => emptyLikesMock());
|
|
//
|
|
// Tests that assert on liked-state changes (LikeButton.test.ts) keep
|
|
// their state-driven mocks inline.
|
|
|
|
import { readable } from 'svelte/store';
|
|
import { vi } from 'vitest';
|
|
|
|
export function emptyLikesMock() {
|
|
return {
|
|
createLikedIdsQuery: () =>
|
|
readable({
|
|
data: { track_ids: [], album_ids: [], artist_ids: [] },
|
|
isPending: false,
|
|
isError: false
|
|
}),
|
|
likeEntity: vi.fn().mockResolvedValue(undefined),
|
|
unlikeEntity: vi.fn().mockResolvedValue(undefined)
|
|
};
|
|
}
|