@dbs-portal/core-api
Version:
HTTP client and API utilities for DBS Portal
25 lines • 972 B
TypeScript
/**
* Test utils for MSW integration tests
* This file contains utilities to help with MSW testing in Node.js environment
*/
import type { RequestHandler } from 'msw';
import { http } from 'msw';
/**
* Base URL for API requests in tests
*/
export declare const TEST_BASE_URL = "http://localhost:3000";
/**
* Helper to ensure proper URL format for MSW handlers
* This is particularly important for MSW v2 which needs exact URL matching
*/
export declare function createTestUrl(path: string): string;
/**
* Creates proper request headers for MSW testing in Node environment
* This helps with IPv4/IPv6 localhost resolution issues
*/
export declare function createTestHeaders(): HeadersInit;
/**
* Create a GET handler with proper URL for tests
*/
export declare function createTestHandler(method: 'get' | 'post' | 'put' | 'delete' | 'patch', path: string, resolver: Parameters<typeof http.get>[1]): RequestHandler;
//# sourceMappingURL=msw-test-helpers.d.ts.map