mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-08-28 08:35:57 +00:00
feat: add hashline editing and TypeScript LSP
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import test from "node:test";
|
||||
|
||||
import { deployBundleHashlineConfig } from "../extensions/hashline-config.ts";
|
||||
|
||||
const EXPECTED_CONFIG = {
|
||||
hashLength: 2,
|
||||
grep: false,
|
||||
replaceText: false,
|
||||
};
|
||||
|
||||
test("hashline config deployment enforces bundle defaults", async () => {
|
||||
const agentDir = await mkdtemp(join(tmpdir(), "my-pi-hashline-"));
|
||||
const targetPath = join(agentDir, "hashline.json");
|
||||
|
||||
try {
|
||||
await writeFile(targetPath, '{"grep":true}\n', "utf8");
|
||||
deployBundleHashlineConfig(agentDir);
|
||||
assert.deepEqual(JSON.parse(await readFile(targetPath, "utf8")), EXPECTED_CONFIG);
|
||||
|
||||
const first = await readFile(targetPath, "utf8");
|
||||
deployBundleHashlineConfig(agentDir);
|
||||
assert.equal(await readFile(targetPath, "utf8"), first);
|
||||
} finally {
|
||||
await rm(agentDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user