@dbs-portal/tool-mock
Version:
API mocking toolkit using MSW for DBS Portal development workflows
36 lines • 1.15 kB
TypeScript
/**
* Testing helper utilities - thin wrappers around Jest and MSW
*/
import type { RequestHandler } from 'msw';
/**
* Create a mock API handler - simple wrapper around MSW's http handlers
*/
export declare function createMockHandler(method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', url: string, response: any, options?: {
status?: number;
delay?: number;
headers?: Record<string, string>;
}): RequestHandler;
/**
* Create a mock error handler
*/
export declare function createMockErrorHandler(method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', url: string, error: {
status: number;
code: string;
message: string;
details?: any;
}, options?: {
delay?: number;
}): RequestHandler;
/**
* Add handlers to the test server - wrapper around MSW's server.use()
*/
export declare function addTestHandlers(...handlers: RequestHandler[]): void;
/**
* Reset test handlers - wrapper around MSW's server.resetHandlers()
*/
export declare function resetTestHandlers(): void;
/**
* Quick utilities for common test scenarios
*/
export declare const testUtils: Record<string, any>;
//# sourceMappingURL=helpers.d.ts.map