test(hub): keep the inbox-gone harness clear of page-inbox names
🧪 Test / 🧪 Lock + lint (push) Waiting to run
🧪 Test / 🧪 Lock + lint (push) Waiting to run
d695bb2added a top-level const answers to page-inbox.js; the harness of test_hub_inbox_gone runs the page modules and its own code in one Node VM and declared let answers too, so setUpClass died on a SyntaxError and the gate on88c232fwent red. The harness now calls its fetch table replies. 🎯 Fix: 97 % 💥 Break: 0 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 97 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 % Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
88c232fd20
commit
6b36e80dad
1 file changed
+4
-4
@@ -55,7 +55,7 @@ let renders = [];
|
|||||||
let atLoad = null;
|
let atLoad = null;
|
||||||
let loads = 0;
|
let loads = 0;
|
||||||
let reloaded = null;
|
let reloaded = null;
|
||||||
let answers = {};
|
let replies = {};
|
||||||
toast = (title, lines, good) => { toasts.push([title, lines, good]); return {remove() {}}; };
|
toast = (title, lines, good) => { toasts.push([title, lines, good]); return {remove() {}}; };
|
||||||
render = (force) => { renders.push(force); };
|
render = (force) => { renders.push(force); };
|
||||||
drawStream = () => {};
|
drawStream = () => {};
|
||||||
@@ -68,7 +68,7 @@ load = async () => {
|
|||||||
};
|
};
|
||||||
fetch = async (path) => {
|
fetch = async (path) => {
|
||||||
posts.push(path);
|
posts.push(path);
|
||||||
const answer = answers[path] || [500, "unexpected " + path];
|
const answer = replies[path] || [500, "unexpected " + path];
|
||||||
if (answer === "offline") {
|
if (answer === "offline") {
|
||||||
throw new TypeError("Failed to fetch");
|
throw new TypeError("Failed to fetch");
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ async function scenario(name, shown, given, act, after) {
|
|||||||
atLoad = null;
|
atLoad = null;
|
||||||
loads = 0;
|
loads = 0;
|
||||||
reloaded = after || null;
|
reloaded = after || null;
|
||||||
answers = given;
|
replies = given;
|
||||||
await act();
|
await act();
|
||||||
results[name] = {inbox: state.inbox.map((item) => item.id), atLoad, loads, renders: renders.length, toasts: [...toasts], posts: [...posts], busy: ui.busy};
|
results[name] = {inbox: state.inbox.map((item) => item.id), atLoad, loads, renders: renders.length, toasts: [...toasts], posts: [...posts], busy: ui.busy};
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ const grantBoth = () => submit(state.inbox.map((item) => entryOf(item, "approve"
|
|||||||
await scenario("bulk_409", ["gone", "kept"], {"/api/sign": reply(409, '{"status": "held"}')}, grantBoth, ["kept"]);
|
await scenario("bulk_409", ["gone", "kept"], {"/api/sign": reply(409, '{"status": "held"}')}, grantBoth, ["kept"]);
|
||||||
state.inbox = [items.gone, items.kept, items.later].map((item) => ({...item}));
|
state.inbox = [items.gone, items.kept, items.later].map((item) => ({...item}));
|
||||||
renders = [];
|
renders = [];
|
||||||
answers = {"/api/state?": reply(200, JSON.stringify({inbox: [items.kept], radio: [], settings: {}, now: now + 10}))};
|
replies = {"/api/state?": reply(200, JSON.stringify({inbox: [items.kept], radio: [], settings: {}, now: now + 10}))};
|
||||||
await fresh();
|
await fresh();
|
||||||
results.refresh = {inbox: state.inbox.map((item) => item.id), renders, offline: ui.offline};
|
results.refresh = {inbox: state.inbox.map((item) => item.id), renders, offline: ui.offline};
|
||||||
console.log(JSON.stringify(results));
|
console.log(JSON.stringify(results));
|
||||||
|
|||||||
Reference in new issue
Block a user