RuneStone 1.0.0
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { chromeLayout, detectChrome, extensionOf, treeFileParts } from "../../../src/lib/workspace/chrome.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"), "Source");
|
||||
assert.equal(detectChrome("tools/setup.sh"), "Source");
|
||||
assert.equal(detectChrome("Makefile"), "Source");
|
||||
});
|
||||
|
||||
test("writing chrome wraps and hides the code gutters", () => {
|
||||
assert.deepEqual(chromeLayout("Writing"), { wrap: true, gutters: false, activeLine: false });
|
||||
});
|
||||
|
||||
test("ide chrome shows the code gutters and does not wrap", () => {
|
||||
assert.deepEqual(chromeLayout("Source"), { wrap: false, gutters: true, activeLine: 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: "" });
|
||||
});
|
||||
Reference in New Issue
Block a user