Make Project Management a native feature
- Move the storage and model of the plugin into src/lib/features/pm/ as pure TypeScript, so the skill can still bundle them. - Move the DOM interface onto the host menus, the shared tooltip, and the host icons. - A ribbon button opens Project Management. Board tabs keep the owner runestone.pm and the board-<hex> view IDs through view patterns. - Read only .runestone/pm/. Offer the plugin migration, with backups, for legacy notes. - A save, move, or delete reads only that card again. Watcher paths reach the feature. - Add Settings → Project Management and the projectManagement section. View states move to localStorage. - Background reads the boards from workspace.json. Remove api.backgrounds and the boards service. - Add yaml 2.9.1. Use the host markdown-it. - Move 18 plugin test files to tests/unit/features/pm/ and add native tests.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { TaskStore } from "../../../../src/lib/features/pm/model/store.ts";
|
||||
import { newTask, readTask } from "../../../../src/lib/features/pm/storage/notes.ts";
|
||||
import type { Workspace } from "../../../../src/lib/features/pm/model/model.ts";
|
||||
|
||||
test("subtask promotion retains checklist data and retries without duplicate cards", async () => {
|
||||
const parent = newTask("Parent", { status: "todo", tags: [], sessions: [], archived: false,
|
||||
subtasks: [{ id: "child", title: "Child", done: true }], priority: "high" }, "Keep the description");
|
||||
const files = new Map([["Parent.md", parent.source]]);
|
||||
const parentId = readTask("Parent.md", parent.source)!.id;
|
||||
let fail = true;
|
||||
const workspace: Workspace = {
|
||||
async list(folder = "") { return [...files.keys()].filter(path => folder ? path.startsWith(`${folder}/`) : !path.startsWith(".")).map(path => ({ name: path.split("/").at(-1)!, rel_path: path, kind: "file" })); },
|
||||
async read(path) { if (!files.has(path)) throw Error("Missing"); return files.get(path)!; },
|
||||
async readOptional(path) { return files.get(path) ?? null; },
|
||||
async create(path, source) { if (files.has(path)) throw Error("Exists"); files.set(path, source); },
|
||||
async write(path, source, expected) { if (fail) throw Error("Write failed"); assert.equal(files.get(path), expected); files.set(path, source); },
|
||||
};
|
||||
const store = new TaskStore(workspace);
|
||||
await store.reload();
|
||||
await assert.rejects(store.openSubtask(parentId, "child"), /Write failed/);
|
||||
fail = false;
|
||||
const child = await store.openSubtask(parentId, "child");
|
||||
assert.equal(child.title, "Child"); assert.equal(child.status, "done"); assert.equal(child.priority, undefined);
|
||||
assert.equal(store.tasks.length, 2);
|
||||
const saved = readTask("Parent.md", files.get("Parent.md")!)!;
|
||||
assert.equal(saved.subtasks![0].taskId, child.id);
|
||||
assert.equal(saved.body, "Keep the description"); assert.equal(saved.priority, "high");
|
||||
assert.equal((await store.openSubtask(parentId, "child")).id, child.id);
|
||||
assert.equal(store.tasks.length, 2);
|
||||
});
|
||||
Reference in New Issue
Block a user