- Add lyricsStore for frontend state management with LRC parsing - Wire LyricsSidebar to main layout with toggle button in NowPlayingBar - Fix Rust compile errors (add Clone to LrclibItem, remove unused import) - Add lyrics active line tracking with binary search - Auto-start/stop lyrics updates based on playback state
30 lines
590 B
TypeScript
30 lines
590 B
TypeScript
/**
|
|
* Vitest Setup
|
|
*
|
|
* Mocks Tauri APIs for unit testing frontend stores.
|
|
*/
|
|
|
|
import { vi } from 'vitest';
|
|
|
|
// Mock @tauri-apps/api/core
|
|
vi.mock('@tauri-apps/api/core', () => ({
|
|
invoke: vi.fn()
|
|
}));
|
|
|
|
// Mock @tauri-apps/api/event
|
|
vi.mock('@tauri-apps/api/event', () => ({
|
|
listen: vi.fn(() => Promise.resolve(() => {})),
|
|
emit: vi.fn()
|
|
}));
|
|
|
|
// Mock localStorage
|
|
const localStorageMock = {
|
|
getItem: vi.fn(),
|
|
setItem: vi.fn(),
|
|
removeItem: vi.fn(),
|
|
clear: vi.fn(),
|
|
length: 0,
|
|
key: vi.fn()
|
|
};
|
|
Object.defineProperty(globalThis, 'localStorage', { value: localStorageMock });
|