chore(tracker-web): type proxy test request
Replace the tracker proxy test helper's any cast with an explicit NextRequest test double bridge. Verification: pnpm --filter @bytelyst/tracker-web typecheck; pnpm --filter @bytelyst/tracker-web test; pnpm --filter @bytelyst/tracker-web exec eslint . --ext .ts,.tsx; pnpm lint.
This commit is contained in:
parent
afe7d88869
commit
b6da94dd4a
@ -3,6 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||||
|
import type { NextRequest } from 'next/server';
|
||||||
|
|
||||||
// Mock global fetch
|
// Mock global fetch
|
||||||
const mockFetch = vi.fn();
|
const mockFetch = vi.fn();
|
||||||
@ -15,7 +16,7 @@ function mockNextRequest(
|
|||||||
path: string,
|
path: string,
|
||||||
body?: string,
|
body?: string,
|
||||||
headers?: Record<string, string>
|
headers?: Record<string, string>
|
||||||
) {
|
): NextRequest {
|
||||||
const _url = new URL(`http://localhost:3003/api/tracker/${path}`);
|
const _url = new URL(`http://localhost:3003/api/tracker/${path}`);
|
||||||
const headerMap = new Map(Object.entries(headers || {}));
|
const headerMap = new Map(Object.entries(headers || {}));
|
||||||
return {
|
return {
|
||||||
@ -27,7 +28,7 @@ function mockNextRequest(
|
|||||||
searchParams: new URLSearchParams(),
|
searchParams: new URLSearchParams(),
|
||||||
},
|
},
|
||||||
text: async () => body || '',
|
text: async () => body || '',
|
||||||
} as any;
|
} as unknown as NextRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('tracker proxy', () => {
|
describe('tracker proxy', () => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user