Files
9router/tests
decolua 8e15f0bdd8 # v0.5.79 (2026-09-18)
## Features
- **Xiaomi MiMo**: merge MiMo Desktop support into `xiaomi-mimo` with dual auth (API key + Desktop/OAuth session), Preview models support, and encrypted-callback OAuth flow
- **Claude Code**: add 1M-context toggle (`[1m]` marker) and drive `CLAUDE_CODE_AUTO_COMPACT_WINDOW` directly from the dashboard
- **Models**: add DeepSeek-V4.1-Flash to DeepSeek provider, CodeBuddy-Intl, and Ollama (`deepseek-v4.1-flash:cloud`); enable `low`..`max` reasoning effort levels and vision capability for DeepSeek-V4.*
- **i18n**: integrate Persian (fa) translation

## Fixes
- **OpenCode / OpenCode Go**: resolve 403 `FreeTierError` and 429 rate limits with canonical session format, valid User-Agent, and stable upstream session reuse; force stream and declare `forceStream` for free-tier SSE aggregation; cloak decoy tools, normalize Muse Free tool choice, and strip prior reasoning items on Responses models; route Union Alpha via Messages API
- **Kiro**: preserve underscores in tool names (`mcp__server__tool`) and restore client tool names in responses; use neutral placeholder for tool-result-only turns; forward tool-result images
- **Stream**: report aborts after HTTP 200 in-band (per-format error frames) instead of closing silently
- **Command Code**: preserve images and `reasoning_effort` on `/alpha/generate`; retry transient stream errors and avoid fake stop chunks; add Quota Tracker support
- **Zed**: harden OAuth lifecycle (preserve `systemId`, renew proxy timeout), support live model resolution, and lower display priority in OAuth list
- **Antigravity**: scope cached thought signatures to model family; strip Claude Code billing headers from system prompts; sanitize Hermes system identity
- **Codex**: route bare `codex-auto-review` requests to the Codex provider (#4135)
- **Auth**: do not cool down an account for request-scoped 4xx errors
- **Usage**: improve DeepSeek credit balance display as currency credit instead of 0/total quota bar
- **Model Catalog**: scope synced catalog to gateways and declare vision capabilities for DeepSeek V4.1-Flash IDs
2026-09-18 18:09:32 +07:00
..
2026-09-18 18:09:32 +07:00

9Router Embeddings Tests

Unit tests for the /v1/embeddings endpoint implementation.

Setup

Install test dependencies from the tests/ directory:

cd tests/ && npm install

Running Tests

From the tests/ directory:

npm test

Or run vitest directly with npx:

npx vitest run --reporter=verbose --config ./vitest.config.js

Test Files

File What it tests
unit/embeddingsCore.test.js open-sse/handlers/embeddingsCore.js — core logic: body builder, URL router, headers, handler flow
unit/embeddings.cloud.test.js cloud/src/handlers/embeddings.js — cloud worker handler: auth, validation, rate limits, CORS

Coverage Summary (59 tests)

embeddingsCore.test.js (36 tests)

  • buildEmbeddingsBody: single string, array, encoding_format, default float
  • buildEmbeddingsUrl: openai, openrouter, openai-compatible-*, unsupported providers
  • buildEmbeddingsHeaders: per-provider header sets, fallback to accessToken
  • handleEmbeddingsCore input validation: missing, wrong type, null, empty
  • handleEmbeddingsCore success: response format, CORS, Content-Type, callbacks
  • handleEmbeddingsCore errors: 400/429/500, network error, invalid JSON
  • handleEmbeddingsCore token refresh: 401 retry, graceful fallback

embeddings.cloud.test.js (23 tests)

  • CORS OPTIONS: 200 response, empty body, correct headers
  • Authentication: missing key, bad format, old-format key, wrong key value, valid key
  • Body validation: invalid JSON, missing model, missing input, bad model
  • Happy path: single string, array, correct delegation, CORS header, machineId override
  • Rate limiting: all accounts rate-limited → 503 + Retry-After, no credentials → 400
  • Error propagation: non-fallback errors passed through, 429 exhausts accounts
  • machineId override: validates key, rejects wrong key