feat: add main features
Agents for developpement added + frontend add + backend added. Git viewer created + agent and template creator + layout and project creator
This commit is contained in:
33
frontend/src/features/git/gitTree.test.ts
Normal file
33
frontend/src/features/git/gitTree.test.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
|
||||
import { buildFileTree } from "./gitTree";
|
||||
|
||||
describe("buildFileTree", () => {
|
||||
it("folds paths into a nested directory tree", () => {
|
||||
const tree = buildFileTree([
|
||||
{ path: "src/app/main.rs", staged: false },
|
||||
{ path: "src/lib.rs", staged: true },
|
||||
{ path: "README.md", staged: false },
|
||||
]);
|
||||
|
||||
// Directories first, then files, alphabetically: src/ then README.md.
|
||||
expect(tree.map((n) => n.name)).toEqual(["src", "README.md"]);
|
||||
|
||||
const src = tree[0];
|
||||
expect(src.isDir).toBe(true);
|
||||
// Inside src: app/ (dir) then lib.rs (file).
|
||||
expect(src.children.map((n) => n.name)).toEqual(["app", "lib.rs"]);
|
||||
expect(src.children[0].isDir).toBe(true);
|
||||
expect(src.children[0].children[0].path).toBe("src/app/main.rs");
|
||||
expect(src.children[1].path).toBe("src/lib.rs");
|
||||
|
||||
// The README leaf keeps its full path + staged flag.
|
||||
const readme = tree[1];
|
||||
expect(readme.isDir).toBe(false);
|
||||
expect(readme.path).toBe("README.md");
|
||||
});
|
||||
|
||||
it("returns an empty array for no files", () => {
|
||||
expect(buildFileTree([])).toEqual([]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user