Unit tests go to tests/unit/<area>/, browser smoke tests to tests/smoke/<area>/, and tests against a running desktop app to tests/native/. Files named after dates, work passes, or Kanban cards get feature names, for example editorOctober12 -> editor/footnotes. scripts/ keeps the build, release, and package tools. Plugin repositories import scripts/packagePlugin.mjs, and the Terminal smoke test imports scripts/pluginMocks.mjs, which now re-exports the harness copy. The unit tests get their own type check (tests/tsconfig.json) with Node types. pnpm check runs it after the app check. Add @types/node and fix the three test mocks that it reported.
42 lines
1.6 KiB
TypeScript
42 lines
1.6 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
import { detectChrome, extensionOf, treeFileParts } from "../../../src/lib/workspace/chrome.ts";
|
|
import { monacoChrome } from "../../../src/lib/editor/monacoChrome.ts";
|
|
|
|
test("markdown files open in writing chrome", () => {
|
|
assert.equal(detectChrome("notes/inbox.md"), "Writing");
|
|
assert.equal(detectChrome("README.markdown"), "Writing");
|
|
});
|
|
|
|
test("scripts open in ide chrome", () => {
|
|
assert.equal(detectChrome("src/hello.py"), "Ide");
|
|
assert.equal(detectChrome("tools/setup.sh"), "Ide");
|
|
assert.equal(detectChrome("Makefile"), "Ide");
|
|
});
|
|
|
|
test("writing chrome wraps and hides line numbers", () => {
|
|
assert.equal(monacoChrome("Writing").wordWrap, "on");
|
|
assert.equal(monacoChrome("Writing").lineNumbers, "off");
|
|
assert.equal(monacoChrome("Writing").minimap.enabled, false);
|
|
});
|
|
|
|
test("ide chrome shows line numbers and no wrap", () => {
|
|
assert.equal(monacoChrome("Ide").wordWrap, "off");
|
|
assert.equal(monacoChrome("Ide").lineNumbers, "on");
|
|
assert.equal(monacoChrome("Ide").minimap.enabled, true);
|
|
});
|
|
|
|
test("extensionOf reads the last suffix", () => {
|
|
assert.equal(extensionOf("a/b.c.py"), "py");
|
|
assert.equal(extensionOf(".gitignore"), "");
|
|
});
|
|
|
|
test("treeFileParts splits a display name from its extension", () => {
|
|
assert.deepEqual(treeFileParts("inbox.md"), { label: "inbox", ext: "md" });
|
|
assert.deepEqual(treeFileParts("chrome_extensions.json"), {
|
|
label: "chrome_extensions",
|
|
ext: "json",
|
|
});
|
|
assert.deepEqual(treeFileParts(".gitignore"), { label: ".gitignore", ext: "" });
|
|
});
|