Expose closed module types and define stable presentation occurrences
This commit is contained in:
@@ -211,3 +211,28 @@ test("unrecognized module consumers fail before artifact execution, not during i
|
||||
/No artifact consumer.*example.device.firmware/,
|
||||
);
|
||||
});
|
||||
|
||||
test("artifact consumers receive checked closed role arguments and prerequisites", async () => {
|
||||
const { moduleTypeContext } = await import("../src/execution-world/module-contracts.js");
|
||||
const { generateInterfaceClientBindings } = await import("../src/execution-world/client-contracts.js");
|
||||
const result = compile();
|
||||
assert.ok(result.ok, JSON.stringify(result.diagnostics));
|
||||
const role = result.workspace.interfaceImports.find((iface) => iface.application)!;
|
||||
const expected = [{ kind: "object", target: { kind: "interface", interfaceRevisionId: "interface:data@1" } }];
|
||||
assert.deepEqual(moduleTypeContext(role), { typeArguments: expected });
|
||||
const plan = compileExecutionPlan(result.workspace);
|
||||
assert.deepEqual(
|
||||
plan.definition.packages[0]!.modules!.find((module) => module.displayName === "Editor")!.typeArguments,
|
||||
expected,
|
||||
);
|
||||
assert.match(generateInterfaceClientBindings({ Editor: role }), /"typeArguments":\[/);
|
||||
assert.deepEqual(moduleTypeContext(interfaces.get("Row")!), {});
|
||||
// Prerequisites are public nominal contracts, never private storage inventory.
|
||||
assert.deepEqual(
|
||||
moduleTypeContext({
|
||||
...role,
|
||||
requiredInterfaces: [capabilityId.interfaceRevision("z"), capabilityId.interfaceRevision("a")],
|
||||
}).requiredInterfaces,
|
||||
["a", "z"],
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user