fix: count dollar-prefixed directories as literal paths

This commit is contained in:
Thomas Durieux committed 2026-11-03 15:09:10 +00:00
1 parent d4b9fd85e7
commit 7ffbfd09d7
2 files changed
+8 -1

No files matched your search

+7
View File
@@ -66,6 +66,13 @@ describe("folder count request validation", () => {
expect(JSON.stringify(scoped)).not.to.match(/Alice|Bob/);
});
for (const name of ["$data", "$$ROOT", "$$CURRENT"]) it(`treats directory ${name} as a literal in aggregation expressions`, async () => {
await insert([{ name, path: "" }, { name: "direct.txt", path: name, size: 1 },
{ name: "$nested", path: name }, { name: "child.txt", path: `${name}/$nested`, size: 1 }]);
expect(await folderCounts(repo, name)).to.deep.equal({ [name]: 2, [`${name}/$nested`]: 1 });
expect(await folderCounts(repo, `${name}/$nested`)).to.deep.equal({ [`${name}/$nested`]: 1 });
});
it("uses the active generation on each request without reusing obsolete counts", async () => {
await insert([{ path: "old", name: "a", size: 1 }]);
expect(await folderCounts(repo, "")).to.deep.equal({ "": 1, old: 1 });