Creating a unit test in Teasim is easy.
You can use bun:test
to create a unit test with Teasim.
Teasim instance has a handle
method that accepts Request
and will return a Response
, the same as creating an HTTP request.
You can also use other testing libraries like Jest to create a unit test for Teasim, but we recommended to use bun:test
over others.
When creating a Request to Teasim server, Teasim expects an entire valid URL, NOT a part of a URL.
For instance, "http://localhost/" is valid but "/user" is not.