fix: validate branch inputs (empty names, negative versions)

This commit is contained in:
Brendan Clement
2026-06-03 09:57:45 -07:00
parent 1ee490d125
commit 735a7ce6fe
4 changed files with 83 additions and 1 deletions

View File

@@ -133,6 +133,16 @@ describe.each([arrow15, arrow16, arrow17, arrow18])(
expect(await (await db.openTable("some_table")).countRows()).toBe(1);
});
it("rejects invalid branch inputs", async () => {
const branches = await table.branches();
await expect(branches.create("")).rejects.toThrow("non-empty");
await expect(branches.checkout("")).rejects.toThrow("non-empty");
await expect(branches.delete("")).rejects.toThrow("non-empty");
await expect(branches.create("bad", "main", -1)).rejects.toThrow(
"non-negative",
);
});
it("should show table stats", async () => {
await table.add([{ id: 1 }, { id: 2 }]);
await table.add([{ id: 1 }]);