// Default empty-playlists mock for $lib/api/playlists. The
// dominant shape across the menu / card tests: no playlists for
// the user, append/create as resolved spies.
//
// Usage:
//   vi.mock('$lib/api/playlists', () => emptyPlaylistsMock());
//
// Tests that exercise richer return payloads (AddToPlaylistMenu's
// full PlaylistDetail return, PlaylistCard's getPlaylist, route
// tests that need owned playlists pre-populated) keep custom
// mocks inline.

import { readable } from 'svelte/store';
import { vi } from 'vitest';

export function emptyPlaylistsMock() {
  return {
    createPlaylistsQuery: () =>
      readable({ data: { owned: [], public: [] }, isPending: false, isError: false }),
    appendTracks: vi.fn().mockResolvedValue({ id: 'p1', tracks: [] }),
    createPlaylist: vi.fn().mockResolvedValue({ id: 'p1', name: 'New' })
  };
}
