Packages@robojs/server
TestClient
Interface: TestClient
Test client instance for testing multiple routes
Methods
delete()
delete(path, options?): Promise<TestRouteResult>Execute a DELETE request
Parameters
| Parameter | Type |
|---|---|
path | string |
options? | Omit<TestRequestOptions, "method"> |
Returns
Promise<TestRouteResult>
get()
get(path, options?): Promise<TestRouteResult>Execute a GET request
Parameters
| Parameter | Type |
|---|---|
path | string |
options? | Omit<TestRequestOptions, "method"> |
Returns
Promise<TestRouteResult>
head()
head(path, options?): Promise<TestRouteResult>Execute a HEAD request
Parameters
| Parameter | Type |
|---|---|
path | string |
options? | Omit<TestRequestOptions, "method"> |
Returns
Promise<TestRouteResult>
options()
options(path, options?): Promise<TestRouteResult>Execute an OPTIONS request
Parameters
| Parameter | Type |
|---|---|
path | string |
options? | Omit<TestRequestOptions, "method"> |
Returns
Promise<TestRouteResult>
patch()
patch(path, options?): Promise<TestRouteResult>Execute a PATCH request
Parameters
| Parameter | Type |
|---|---|
path | string |
options? | Omit<TestRequestOptions, "method"> |
Returns
Promise<TestRouteResult>
post()
post(path, options?): Promise<TestRouteResult>Execute a POST request
Parameters
| Parameter | Type |
|---|---|
path | string |
options? | Omit<TestRequestOptions, "method"> |
Returns
Promise<TestRouteResult>
put()
put(path, options?): Promise<TestRouteResult>Execute a PUT request
Parameters
| Parameter | Type |
|---|---|
path | string |
options? | Omit<TestRequestOptions, "method"> |
Returns
Promise<TestRouteResult>
request()
request(
method,
path,
options?): Promise<TestRouteResult>Execute a request with any method
Parameters
| Parameter | Type |
|---|---|
method | "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD" |
path | string |
options? | Omit<TestRequestOptions, "method"> |
Returns
Promise<TestRouteResult>
route()
route(pattern, module): TestClientRegister a route module
Parameters
| Parameter | Type |
|---|---|
pattern | string |
module | ApiHandlerModule |
