Old project/workflow names and browser settings migrate on load; /funpack redirects to /fun. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016acRss69eH1235eRdFTZHY
41 lines
1.6 KiB
JavaScript
41 lines
1.6 KiB
JavaScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { startLoading } from "./loading.js";
|
|
|
|
const fake = () => {
|
|
const log = { closed: 0, text: "", pct: -1 };
|
|
const c = {
|
|
text: { md: ({ text }) => ({ setText: (t) => { log.text = t; log.text0 = text; } }) },
|
|
progress: { bar: () => ({ node: {}, setValue: (v) => { log.pct = v; } }) },
|
|
region: { stack: () => ({}) },
|
|
modal: { generic: (p) => { log.props = p; return { close: () => { log.closed++; } }; } },
|
|
};
|
|
return { c, log };
|
|
};
|
|
|
|
test("the window cannot be dismissed, names the module and its place, and closes once", () => {
|
|
const { c, log } = fake();
|
|
const l = startLoading(c);
|
|
assert.equal(log.props.closeOnEsc, false);
|
|
assert.equal(log.props.closeOnOutside, false);
|
|
l.progress({ n: 2, of: 4, path: "./features/timeline/index.js" });
|
|
assert.equal(log.text, "Loading module 2 out of 4: timeline. Please wait for UI to finish loading.");
|
|
assert.equal(log.pct, 25);
|
|
l.progress({ n: 3, of: 4, path: "./features/render/selected.js" });
|
|
assert.match(log.text, /3 out of 4: render\/selected\./);
|
|
l.done(); l.done();
|
|
assert.equal(log.closed, 1);
|
|
});
|
|
|
|
test("a kit that cannot draw the window does not stop the app", () => {
|
|
const l = startLoading({});
|
|
l.progress({ n: 1, of: 1, path: "./features/a/index.js" });
|
|
l.done();
|
|
});
|
|
|
|
test("a full address before the feature name is not shown", () => {
|
|
const { c, log } = fake();
|
|
startLoading(c).progress({ n: 1, of: 2, path: "http://127.0.0.1:8188/fun/app/ui/features/log/index.js" });
|
|
assert.match(log.text, /1 out of 2: log\. /);
|
|
});
|