Commit Graph
3 Commits
Author SHA1 Message Date
kaitranntt aaa6feb8db fix(tests): remove undefined MockRoute export and unused imports
- Remove MockRoute from index.ts (type was removed in previous commit)
- Remove unused UPLOAD_SUCCESS, UNAUTHORIZED imports from test file
2026-01-23 23:47:09 -05:00
kaitranntt 2b91c40e37 fix(tests): address edge cases in mock infrastructure
- Prevent spy leak on double mockFetch() call
- Differentiate body types (URLSearchParams, ArrayBuffer, Blob, ReadableStream)
- Fix route path parsing to preserve spaces
- Escape regex special chars before wildcard replacement
- Remove unused MockResponse.error and MockRoute interface
2026-01-23 23:41:49 -05:00
kaitranntt 5c83429a79 perf(tests): replace real network ops with mock infrastructure
- Add centralized mock infrastructure in tests/mocks/:
  - mock-fetch.ts: Bun native fetch interception
  - mock-http-server.ts: Fake server responses (no ports)
  - fixtures/responses.ts: Preset response constants
  - types.ts: Mock type definitions

- Refactor https-tunnel-proxy.test.ts:
  - Remove TEST_CERT constant (~50 lines)
  - Remove real HTTPS server creation
  - Use invalid hosts for error path testing
  - 26/26 tests pass in ~430ms

- Refactor remote-token-uploader.test.ts:
  - Replace 7 real HTTP servers with mockFetch
  - Reduce from 422 to 289 lines
  - 18/18 tests pass in ~120ms

- Add global test timeout (10s) in bunfig.toml

Test suite: 10+ min → 14 seconds
2026-01-23 23:35:17 -05:00