31 lines · 1001 B · TypeScript
RawDownload
import { describe, expect, it } from "vite-plus/test"; import { buildFileTreePathUpdates } from "./fileTreePathReconciliation"; describe("buildFileTreePathUpdates", () => {  it("updates only paths that changed", () => {    expect(      buildFileTreePathUpdates(        ["src/", "src/kept.ts", "src/removed.ts"],        ["src/", "src/kept.ts", "src/added.ts"],      ),    ).toEqual([      { type: "remove", path: "src/removed.ts" },      { type: "add", path: "src/added.ts" },    ]);  });   it("removes a missing subtree with one recursive update", () => {    expect(      buildFileTreePathUpdates(        ["src/", "src/feature/", "src/feature/index.ts", "src/kept.ts"],        ["src/", "src/kept.ts"],      ),    ).toEqual([{ type: "remove", path: "src/feature/", recursive: true }]);  });   it("does nothing when a refresh returns the same tree", () => {    const paths = ["src/", "src/index.ts"];    expect(buildFileTreePathUpdates(paths, [...paths])).toEqual([]);  });});

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t