chore: upgrade typescript 6, vitest 4, align spf package (#1101)

This commit is contained in:
rahim
2026-03-24 01:53:36 -07:00
committed by GitHub
parent bc2929ef4f
commit 8e2e56e36e
33 changed files with 536 additions and 971 deletions
+14 -2
View File
@@ -8,16 +8,24 @@
*/
import type { ReactNode } from 'react';
import type { Mock } from 'vitest';
import { vi } from 'vitest';
import { PlayerContextProvider, type PlayerContextValue } from '../player/context';
interface MockStore {
state: Record<string, unknown>;
attach: Mock<() => Mock>;
subscribe: Mock<() => Mock>;
destroy: Mock;
}
/**
* Create a minimal mock store compatible with `PlayerContextValue`.
*
* Pass optional `state` to seed the store's state snapshot.
*/
export function createMockStore(state: Record<string, unknown> = {}) {
export function createMockStore(state: Record<string, unknown> = {}): MockStore {
return {
state,
attach: vi.fn(() => vi.fn()),
@@ -32,7 +40,11 @@ export function createMockStore(state: Record<string, unknown> = {}) {
* Accepts an optional store state seed. Returns the wrapper component,
* the mock store, and the context value for assertions.
*/
export function createPlayerWrapper(storeState: Record<string, unknown> = {}) {
export function createPlayerWrapper(storeState: Record<string, unknown> = {}): {
store: MockStore;
value: PlayerContextValue;
Wrapper: ({ children }: { children: ReactNode }) => ReactNode;
} {
const store = createMockStore(storeState);
const value: PlayerContextValue = {
store: store as any,