[jsweep] Clean convert_gateway_config_gemini.cjs#29878
Conversation
…ni.cjs Add 16 tests covering: - transformGeminiEntry: type removal, URL rewriting, field preservation, immutability, missing url, non-string url, empty entry - main: settings.json output path, URL rewriting, type removal, /tmp/ include dir, CLI server filtering, file permissions (0o600), localhost default, empty servers Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🧪 Test Quality Sentinel ReportTest Quality Score: 85/100✅ Excellent test quality
Test Classification DetailsView all 16 test classifications
Flagged Tests — Requires ReviewNo tests flagged. All tests are behavioral contract tests with no coding-guideline violations. Language SupportTests analyzed:
Verdict
📖 Understanding Test ClassificationsDesign Tests (High Value) verify what the system does:
Implementation Tests (Low Value) verify how the system does it:
Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators.
|
There was a problem hiding this comment.
Pull request overview
Adds a dedicated Vitest suite for convert_gateway_config_gemini.cjs to cover both entry transformation and end-to-end config generation for Gemini CLI.
Changes:
- Adds focused unit tests for
transformGeminiEntry, including URL rewriting,typeremoval, immutability, and edge cases. - Adds integration-style tests for
main()covering workspace output, CLI-server filtering,/tmp/inclusion, permissions, and host-domain behavior. - Uses temporary directories and environment setup/teardown to exercise the converter in a realistic Node.js execution context.
Show a summary per file
| File | Description |
|---|---|
actions/setup/js/convert_gateway_config_gemini.test.cjs |
New dedicated test coverage for Gemini gateway-config conversion behavior and output generation. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 2
| const entry = { type: "http", url: "http://old/mcp/github" }; | ||
| const original = { ...entry }; |
| it("handles empty mcpServers gracefully", () => { | ||
| writeGatewayOutput({}); | ||
|
|
||
| main(); | ||
|
|
|
@copilot review all comments |
…payload tests Agent-Logs-Url: https://github.com/github/gh-aw/sessions/e438bc8e-a350-41cc-9c4f-2430c3fac903 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Addressed both optional suggestions in 484687c:
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Summary
Adds comprehensive tests for
convert_gateway_config_gemini.cjs, the oldest untested file inactions/setup/js/.Context
Execution context: Node.js (runs outside github-script, uses
shim.cjsforcoreglobals)Changes
convert_gateway_config_gemini.test.cjs(new file)The source file was already clean (
@ts-check, modern JS, well-documented), but lacked any dedicated tests. ThetransformGeminiEntryfunction was only partially covered byconvert_gateway_config_adapters.test.cjs. Added 16 tests across two suites:transformGeminiEntry(8 tests):typefield (Gemini transport auto-detection)urlPrefixurlfieldurlvalues unchangedurlPrefixvaluesmain(8 tests):settings.jsonto.gemini/directory in workspaceMCP_GATEWAY_HOST_DOMAINtypefield from all server entries/tmp/incontext.includeDirectoriesGH_AW_MCP_CLI_SERVERS)0o600permissions (bearer token protection)localhostas default whenMCP_GATEWAY_HOST_DOMAINis unsetmcpServersgracefullyValidation
npm run format:cjs— no changes needednpm run lint:cjs— all files passnpm run typecheck— no new errors (pre-existing errors in other files unrelated to this change)convert_gateway_config_gemini.test.cjs