Add unit tests for the Claude, Gemini and MiniMax director adapters

Open Beginner friendly
#6 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript, node.js
Domain
backend, testing

Research direction

Read test/providers.test.mjs:15-31 for the fake fetch pattern, then inspect the adapter entry points in server/providers/llm/index.mjs:7-63. Add test/llm.test.mjs assertions for the specified requests, parsed replies, URL overrides and empty reply error. Run node --test test/llm.test.mjs; done means those checks pass without network access or API keys.

Written by the indexing model from the issue text.

Description

good first issue tests

Every image adapter has a scripted-fake test in test/providers.test.mjs. Director adapters are only tested once, indirectly: direct() with DeepSeek, through the shared OpenAI-compatible compat() adapter. These parts have no coverage:

  • Claude (anthropic.chat): the x-api-key and anthropic-version headers, the top-level system field, and joining the text blocks of content
  • Gemini (gemini.chat): the x-goog-api-key header, systemInstruction, responseMimeType: 'application/json', and reading candidates[0].content.parts
  • MiniMax: compat() deliberately leaves out response_format for id === 'minimax'. Nothing checks that it stays out.
  • Base-URL overrides such as DASHSCOPE_COMPAT_URL and MOONSHOT_BASE_URL, read through baseEnv
  • empty replies, which should throw ProviderError … empty reply

Task: add test/llm.test.mjs that calls each adapter's chat() with a fake fetch, using the fake() pattern from test/providers.test.mjs. Assert on the request (URL, headers, body) and on the parsed text. No network or real keys.

Where: server/providers/llm/index.mjs:7-18 (compat), server/providers/llm/index.mjs:20-34 (anthropic), server/providers/llm/index.mjs:36-53 (gemini), server/providers/llm/index.mjs:63 (minimax entry); pattern to copy at test/providers.test.mjs:15-31.

Done when: node --test test/llm.test.mjs passes with no network and no keys set, asserting the request URL, headers and body plus the parsed text for Claude and Gemini, that the MiniMax request body has no response_format, that setting DASHSCOPE_COMPAT_URL or MOONSHOT_BASE_URL changes the request URL, and that an empty reply throws ProviderError with "empty reply"; npm test stays green.


Getting started: Node 22, no npm install needed: git clone, then npm test and npm run check. Comment here to claim it. Questions → Discord.

Dominant language
JavaScript
Stars
42
Forks
6
Avg merge
12h 31m
Merged PRs (30d)
3

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from blixvip/GenMotion

All issues in blixvip/GenMotion

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.