Unit testing with Tanstack Start

Hey guys, I can't find any info on this so hoping someone here can help.

I want to put unit tests in place for some of my server functions and middleware but I haven't been able to figure out how to call the relevant handlers.

Currently the only way I can tests the handler logic is to split it out from the server function definition (i.e. export a function and supply to the .handler / .server methods) but this feels like overkill and I'm not sure I want to expose functions just for the sake of testing discrete parts of the flow - doesn't feel right.

Anyone got any insight on this one?

(Also saw this question but no answer/insight given start-questionsUnit testing routes and middleware)
Was this page helpful?