docs: dire l'effet et non le canal, et n'exiger le NURI en dur que d'un index global
This commit is contained in:
@@ -154,6 +154,29 @@ test("an index declaring no field at all is still refused", async () => {
|
||||
await expect((await indexing(ownerPort)).read(ordinary)).rejects.toThrow(/declares no index field/);
|
||||
});
|
||||
|
||||
test("curating a document that declares no field refuses, and writes nothing", async () => {
|
||||
const network = new FakeNextGraph();
|
||||
const ownerPort = network.portFor("alice");
|
||||
const bobPort = network.portFor("bob");
|
||||
|
||||
// A document of Alice's with an inbox open and a reference waiting in it, and no
|
||||
// field declared. This is also the shape an INDEX arrives in when it could not be
|
||||
// read — the real `readUnion` turns a failed read into `[]` — so the two are one
|
||||
// case here, and the refusal has to hold for both.
|
||||
const noField = await ownerPort.createPublicDocument();
|
||||
await ownerPort.openInbox(noField);
|
||||
const article = await publishObject(bobPort, FIELD, "2026-01-01");
|
||||
await (await indexing(bobPort)).refer(noField, article);
|
||||
|
||||
await expect(curate(ownerPort, noField)).rejects.toThrow(/declares no index field/);
|
||||
|
||||
// It refused instead of curating on a field it does not have, and it refused
|
||||
// BEFORE writing: the document is still empty, so no entry was invented for it,
|
||||
// and the deposit is still in the inbox for a run that knows what to do with it.
|
||||
expect(await ownerPort.readDocument(noField)).toEqual([]);
|
||||
expect(await ownerPort.readDeposits(noField)).toHaveLength(1);
|
||||
});
|
||||
|
||||
test("a field that could never match an object is refused at creation", async () => {
|
||||
const owner = await indexing(new FakeNextGraph().portFor("alice"));
|
||||
// It cannot be corrected later — nothing here deletes — so it is refused now.
|
||||
|
||||
Reference in New Issue
Block a user