summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-03-16 05:42:41 -0300
committerEuAndreh <eu@euandre.org>2024-03-16 05:42:47 -0300
commit4a584566035d18402f2bc65bf2c7e433ecbd595c (patch)
treebd9a6ab56d6f721de5e417b969eac955a45c4002 /tests
parentsrc/hero.mjs: interceptors.contentType(): Generate body from status when missing (diff)
downloadpapod-4a584566035d18402f2bc65bf2c7e433ecbd595c.tar.gz
papod-4a584566035d18402f2bc65bf2c7e433ecbd595c.tar.xz
src/hero.mjs: Add "upgrade" and "socket" keys to `req`
Also log on "in-request" the value of "upgrade".
Diffstat (limited to 'tests')
-rw-r--r--tests/js/hero.mjs27
1 files changed, 18 insertions, 9 deletions
diff --git a/tests/js/hero.mjs b/tests/js/hero.mjs
index 8d8f811..b183e9a 100644
--- a/tests/js/hero.mjs
+++ b/tests/js/hero.mjs
@@ -238,6 +238,7 @@ const test_interceptorsFn = async t => {
id: "an ID",
url: "a URL",
method: "a method",
+ upgrade: true,
};
assert.deepEqual(
@@ -515,8 +516,9 @@ const test_wrapHandler = async t => {
]);
const req = {
- url: "URL",
- method: "METHOD",
+ url: "URL",
+ method: "METHOD",
+ upgrade: false,
};
assert.deepEqual(
@@ -540,10 +542,11 @@ const test_wrapHandler = async t => {
contents.map(o => u.dissoc(o, "timings")),
[
{
- id: "0",
- url: "URL",
- method: "METHOD",
- type: "in-request",
+ id: "0",
+ url: "URL",
+ method: "METHOD",
+ type: "in-request",
+ upgrade: false,
},
{
id: "0",
@@ -1096,6 +1099,8 @@ const test_handleRequest = async t => {
a: "1",
b: "two",
},
+ upgrade: false,
+ socket: null,
};
assert.deepEqual(
@@ -1115,6 +1120,8 @@ const test_handleRequest = async t => {
},
ref: req,
handler: fn,
+ upgrade: false,
+ socket: null,
},
);
});
@@ -1160,6 +1167,8 @@ const test_handleRequest = async t => {
},
handler: fn,
ref: req,
+ upgrade: true,
+ socket: fn,
},
);
});
@@ -1700,7 +1709,7 @@ const test_makeReopeningPipeReader = async t => {
fs.createWriteStream(path).end().close();
pipe.ref.on("close", () => {
assert.deepEqual(lines, []);
- assert.deepEqual(logs, [{
+ assert.deepEqual(logs, [{
message: "pipe closed, NOT reopening",
}]);
@@ -1715,8 +1724,8 @@ const test_makeReopeningPipeReader = async t => {
const shouldReopenPipe = { ref: true };
const lines = [];
const logs = [];
- const lineFn = x => lines.push(x);
- const logger = { debug: x => logs.push(x) };
+ const lineFn = x => lines.push(x);
+ const logger = { debug: x => logs.push(x) };
const previous = process.env.DEBUG;
delete process.env.DEBUG;