Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Test refactor#14

Merged
geelen merged 1 commit intomainfrom
better-tests
Jul 1, 2025
Merged

Test refactor#14
geelen merged 1 commit intomainfrom
better-tests

Conversation

@geelen
Copy link
Copy Markdown
Collaborator

@geelen geelen commented Jul 1, 2025

Good prompt:

I'd like to refactor the test in the test directory. At the moment there's an array of test scenarios and a 
separate array of MCP servers. There's also some explicit MCP connection logic that looks for named 
ports like honoPort and cfAgentsPort. I'd like to refactor this so that there is an outer array of servers, 
of which there should only be two since there are only two servers in the example slash servers directory. 
Each server can then get a describe block where the `pnpm dev` command is called in the corresponding 
directory, and then multiple tests are carried out. For example, the hono-mcp server should be booted 
and then it should be tested at /mcp with transport type 'auto' and 'http'. For the cf-agents server, once 
that's booted it should have 4 urls (/public/mcp, /public/sse, /mcp and /sse), each with 2 transport types 
(auto and http for anything ending in /mcp, auto and sse for anything ending in /sse).

Can you refactor this test so that those elements, the starting of the server, the port that the server runs 
on, the URLs that are testing the server and the transport types that correspond to each ones are much 
more centralized rather than littered through this file. As part of this you should create a utils file that has 
completely stateless functions that help with processes like spawning child processes.

You should be able to refactor this and then run the tests to confirm that the same set of tests are still 
being executed just with much cleaner code.

Good Amp.

@geelen geelen merged commit d80a7e6 into main Jul 1, 2025
5 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant