summaryrefslogtreecommitdiff
path: root/tests/js/hero.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/js/hero.mjs')
-rw-r--r--tests/js/hero.mjs19
1 files changed, 7 insertions, 12 deletions
diff --git a/tests/js/hero.mjs b/tests/js/hero.mjs
index 7b8a5cc..bc9d3d2 100644
--- a/tests/js/hero.mjs
+++ b/tests/js/hero.mjs
@@ -1,8 +1,8 @@
import assert from "node:assert/strict";
import http from "node:http";
-import { runTests } from "../runner.mjs";
-import { assocIn } from "../../src/utils.mjs";
+import * as runner from "../runner.mjs";
+import * as u from "../../src/utils.mjs";
import {
normalizeSegments,
pathToSegments,
@@ -17,6 +17,7 @@ import {
makeRequestListener,
interceptorsFn,
interceptors,
+ defaultInterceptors,
chainInterceptors,
wrapHandler,
buildRoutes,
@@ -274,7 +275,7 @@ const test_firstParamMatch = t => {
},
};
- const tree2 = assocIn(tree1, [ "path", "param1", ":deeper", "" ], fn1);
+ const tree2 = u.assocIn(tree1, [ "path", "param1", ":deeper", "" ], fn1);
assert.deepEqual(
firstParamMatch(tree1, segments, params),
@@ -298,7 +299,7 @@ const test_firstParamMatch = t => {
},
};
- const tree2 = assocIn(tree1, ["user", ":aaa", ""], fn1);
+ const tree2 = u.assocIn(tree1, ["user", ":aaa", ""], fn1);
assert.deepEqual(
firstParamMatch(tree1, segments, params),
@@ -1163,14 +1164,8 @@ const test_buildServer = t => {
t.test("integrated application server", async () => {
const socketPath = "./tests/hero-1.sock";
const pathHandler = req => ({ status: 200, body: "OK" });
- const globalInterceptors = [
- interceptors.serverError,
- interceptors.contentType,
- interceptors.requestId,
- interceptors.logged,
- ];
const routes = [ [ "GET", "/path", pathHandler ] ];
- const server = buildServer(routes, globalInterceptors);
+ const server = buildServer(routes, defaultInterceptors);
await server.listen(socketPath);
const response = await socketRequest(socketPath, "/path");
@@ -1181,7 +1176,7 @@ const test_buildServer = t => {
};
-await runTests([
+await runner.runTests([
test_normalizeSegments,
test_pathToSegments,
test_hasPathParams,