feat: file system access, behind a path policy and an approval (#25)
This commit was merged in pull request #25.
This commit is contained in:
@@ -296,3 +296,37 @@ describe("the model selection", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("file access preferences", () => {
|
||||
it("is off when nothing says otherwise", () => {
|
||||
// The default matters more than the setting here: an assistant that can read files
|
||||
// should be one the user switched on, because reading is the half that cannot ask
|
||||
// first.
|
||||
expect(resolvePreferences({}).fileEnabled).toBe(false);
|
||||
});
|
||||
|
||||
it("is on only when the checkbox is ticked", () => {
|
||||
expect(resolvePreferences({ fileAccess: true }).fileEnabled).toBe(true);
|
||||
expect(resolvePreferences({ fileAccess: false }).fileEnabled).toBe(false);
|
||||
});
|
||||
|
||||
it("carries extra roots, and reports the ones it could not use", () => {
|
||||
const resolved = resolvePreferences({
|
||||
readRoots: "/Volumes/Archive\nrelative/oops",
|
||||
writeRoots: "/Volumes/Archive/scratch",
|
||||
});
|
||||
|
||||
expect(resolved.extraReadRoots).toEqual(["/Volumes/Archive"]);
|
||||
expect(resolved.rejectedReadRoots).toEqual(["relative/oops"]);
|
||||
expect(resolved.extraWriteRoots).toEqual(["/Volumes/Archive/scratch"]);
|
||||
expect(resolved.rejectedWriteRoots).toEqual([]);
|
||||
});
|
||||
|
||||
it("has no extra roots when the fields are empty", () => {
|
||||
const resolved = resolvePreferences({});
|
||||
expect(resolved.extraReadRoots).toEqual([]);
|
||||
expect(resolved.extraWriteRoots).toEqual([]);
|
||||
expect(resolved.rejectedReadRoots).toEqual([]);
|
||||
expect(resolved.rejectedWriteRoots).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user