mirror of
https://github.com/morluto/rea.git
synced 2026-11-21 14:05:49 +00:00
fix(environment): bound and validate write state history
This commit is contained in:
1 parent
19b50ea668
commit
a057ea9784
8 files changed
+211
-9
No files matched your search
@@ -536,6 +536,25 @@ describe("collections a create chooses", () => {
|
||||
?.collection,
|
||||
).toBe("/api/orgs/acme1/books");
|
||||
});
|
||||
|
||||
it("refuses an empty parent segment before storing an unreadable collection", () => {
|
||||
const books = servedFrom(ROWS);
|
||||
const tool = books.source.manifest.tools.find(
|
||||
(candidate) => candidate.method === "POST",
|
||||
)!;
|
||||
const [org] = environmentToolArguments(tool).path.values();
|
||||
const before = books.snapshot();
|
||||
expect(
|
||||
books.refusal(tool.name, { [org!]: "", body: { name: "Invalid" } }),
|
||||
).toMatchObject({
|
||||
code: "invalid_request",
|
||||
message: expect.stringContaining("path argument to be non-empty"),
|
||||
});
|
||||
expect(books.snapshot()).toBe(before);
|
||||
expect(
|
||||
books.store.knownCollectionsOf("/api/orgs/{org}/books"),
|
||||
).not.toContain("/api/orgs//books");
|
||||
});
|
||||
});
|
||||
|
||||
describe("missing entities after a delete", () => {
|
||||
|
||||
Reference in new issue
Block a user