Implement independent presentation readiness boundaries
This commit is contained in:
@@ -124,19 +124,20 @@ async function fixture(replacement = "First", change?: (artifact: ReactPreparati
|
||||
test("workspace expands distinct providers' private inputs without parent field declarations", async () => {
|
||||
const { pkg } = await fixture();
|
||||
const parent = pkg.checkedQueries!.find((query) => query.declaration.id === "react:input:library-card:data")!;
|
||||
assert.match(parent.document, /title/);
|
||||
assert.match(parent.document, /detail/);
|
||||
const acquisition = pkg.checkedQueries!.find(
|
||||
(query) =>
|
||||
query.declaration.id ===
|
||||
(parent.declaration.placement?.kind === "local" ? parent.declaration.placement.sourceQueryId : ""),
|
||||
)!;
|
||||
assert.match(acquisition.document, /title/);
|
||||
assert.match(acquisition.document, /detail/);
|
||||
const plan = pkg.queryCompositions!.find((composition) => composition.id === "react:inputs:library-card")!;
|
||||
assert.equal(plan.steps[0]!.query, parent.declaration.id);
|
||||
assert.equal(Object.keys(parent.fragmentContracts ?? {}).length, 2);
|
||||
const discovery = pkg.queryCompositions!.find(
|
||||
(composition) => composition.id === "react:inputs:library-card:discovery",
|
||||
)!;
|
||||
assert.equal(
|
||||
discovery.steps[0]!.query,
|
||||
"LibraryData",
|
||||
"Cold child data cannot block discovering its selected reference",
|
||||
);
|
||||
assert(!pkg.queryCompositions!.some((composition) => composition.id.endsWith(":discovery")));
|
||||
const original = pkg.checkedQueries!.find((query) => query.declaration.id === "LibraryData")!;
|
||||
assert.deepEqual(parent.output, original.output, "Acquisition-only child fields are not parent requirements");
|
||||
assert(Object.values(parent.fragmentContracts!).every((entry) => entry.mode === "reference"));
|
||||
});
|
||||
|
||||
test("eager cycles and wrongly typed child bindings fail before runtime", async () => {
|
||||
@@ -167,7 +168,16 @@ test("eager cycles and wrongly typed child bindings fail before runtime", async
|
||||
test("workspace replacement changes acquisition requirements without changing the parent", async () => {
|
||||
const { pkg } = await fixture("Second");
|
||||
const parent = pkg.checkedQueries!.find((query) => query.declaration.id === "react:input:library-card:data")!;
|
||||
assert.doesNotMatch(parent.document, /\btitle\b/);
|
||||
assert.match(parent.document, /detail/);
|
||||
const acquisition = pkg.checkedQueries!.find(
|
||||
(query) =>
|
||||
query.declaration.id ===
|
||||
(parent.declaration.placement?.kind === "local" ? parent.declaration.placement.sourceQueryId : ""),
|
||||
)!;
|
||||
assert.doesNotMatch(acquisition.document, /\btitle\b/);
|
||||
assert.match(acquisition.document, /detail/);
|
||||
assert.equal(Object.keys(parent.fragmentContracts ?? {}).length, 1);
|
||||
const previous = (await fixture()).pkg.checkedQueries!.find(
|
||||
(query) => query.declaration.id === parent.declaration.id,
|
||||
)!;
|
||||
assert.deepEqual(parent.output, previous.output);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user