murmuraba
Version:
Real-time audio noise reduction with advanced chunked processing for web applications
64 lines • 2.02 kB
TypeScript
/**
* Main test utilities export file
* Import everything from here for a clean, organized test setup
*/
export * from './audio-context-utils';
export * from './console-utils';
export * from './factories';
export * from './custom-matchers';
import './custom-matchers';
import { type AudioContextMockOptions } from './audio-context-utils';
import { useConsoleMocks, type ConsoleMockOptions } from './console-utils';
/**
* Complete test environment setup
* Combines all common test setup patterns
*/
export interface TestEnvironmentOptions {
audio?: AudioContextMockOptions;
console?: ConsoleMockOptions;
wasm?: {
rnnoiseState?: number;
vadProbability?: number;
};
fetch?: boolean;
timers?: boolean;
}
export interface TestEnvironment {
audioContext: any;
consoleMocks: ReturnType<typeof useConsoleMocks>;
wasmModule?: any;
cleanup: () => void;
}
/**
* Setup complete test environment with all common mocks
*/
export declare function setupTestEnvironment(options?: TestEnvironmentOptions): TestEnvironment;
/**
* Helper to wait for async operations
*/
export declare function waitForAsync(ms?: number): Promise<void>;
/**
* Helper to flush all promises
*/
export declare function flushPromises(): Promise<void>;
/**
* Create a deferred promise for testing async operations
*/
export declare function createDeferred<T = void>(): {
promise: Promise<T>;
resolve: (value: T) => void;
reject: (error: any) => void;
};
/**
* Mock performance.now for consistent timing tests
*/
export declare function mockPerformanceNow(sequence: number[]): void;
/**
* Helper for testing error scenarios
*/
export declare function expectAsyncError(fn: () => Promise<any>, errorPattern?: string | RegExp): Promise<void>;
/**
* Create a test suite with common setup
*/
export declare function createTestSuite(name: string, options: TestEnvironmentOptions | undefined, tests: (env: TestEnvironment) => void): void;
//# sourceMappingURL=test-utils.d.ts.map