forked from r.muellner/velum-raycast
feat: select all files or one folder for project restoration
This commit is contained in:
29
tests/restore-file-selection.test.ts
Normal file
29
tests/restore-file-selection.test.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { listRestorableFolders, selectRestorableFolder } from "../src/lib/restore-file-selection";
|
||||
import type { ProjectFile } from "../src/lib/velum-project";
|
||||
|
||||
const files: ProjectFile[] = [
|
||||
{ relPath: "A/Notiz.txt", absPath: "", kind: "text", size: 0 },
|
||||
{ relPath: "A/Unterordner/Tabelle.xlsx", absPath: "", kind: "document", size: 0 },
|
||||
{ relPath: "AB/Nachbar.txt", absPath: "", kind: "text", size: 0 },
|
||||
{ relPath: "Wurzel.txt", absPath: "", kind: "text", size: 0 },
|
||||
];
|
||||
|
||||
describe("Ordnerauswahl beim Klartext-Export", () => {
|
||||
it("zeigt übergeordnete Ordner mit der Anzahl ihrer Unterordner-Dateien", () => {
|
||||
expect(listRestorableFolders(files)).toEqual([
|
||||
{ path: "A", fileCount: 2, textCount: 1, documentCount: 1 },
|
||||
{ path: "A/Unterordner", fileCount: 1, textCount: 0, documentCount: 1 },
|
||||
{ path: "AB", fileCount: 1, textCount: 1, documentCount: 0 },
|
||||
]);
|
||||
});
|
||||
|
||||
it("wählt nur den gewählten Ordner rekursiv und keine ähnlich benannten Nachbarn", () => {
|
||||
expect([...selectRestorableFolder(files, "A")]).toEqual([
|
||||
"A/Notiz.txt",
|
||||
]);
|
||||
expect([...selectRestorableFolder(files, "A", true)]).toEqual([
|
||||
"A/Notiz.txt", "A/Unterordner/Tabelle.xlsx",
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user