test(httpapi): add route exerciser
This commit is contained in:
@@ -26,13 +26,17 @@ export function nextTuiRequest() {
|
||||
return request.next()
|
||||
}
|
||||
|
||||
export function submitTuiRequest(body: TuiRequest) {
|
||||
request.push(body)
|
||||
}
|
||||
|
||||
export function submitTuiResponse(body: unknown) {
|
||||
response.push(body)
|
||||
}
|
||||
|
||||
export async function callTui(ctx: Context) {
|
||||
const body = await ctx.req.json()
|
||||
request.push({
|
||||
submitTuiRequest({
|
||||
path: ctx.req.path,
|
||||
body,
|
||||
})
|
||||
|
||||
@@ -122,6 +122,7 @@ export const Client = lazy(() => {
|
||||
})
|
||||
|
||||
export function close() {
|
||||
if (!Client.loaded()) return
|
||||
Client().$client.close()
|
||||
Client.reset()
|
||||
}
|
||||
|
||||
@@ -14,5 +14,7 @@ export function lazy<T>(fn: () => T) {
|
||||
value = undefined
|
||||
}
|
||||
|
||||
result.loaded = () => loaded
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user