Implement query execution, scoped RPC enrichment, live collections, and scaffold integration
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { queryWorkspaceFixture } from "./fixtures/query-workspace.js";
|
||||
import { linkQueries } from "../src/query/link.js";
|
||||
|
||||
test("query fixture links generic collections, both implementations, and native getter/RPC setter", async () => {
|
||||
const { workspace } = await queryWorkspaceFixture();
|
||||
const query = workspace.linkedQueries.find((query) => query.id.endsWith(":upcoming"))!;
|
||||
assert.ok(query);
|
||||
assert.equal(query.fields.filter((field) => field.memberId === "title").length, 2);
|
||||
assert.ok(
|
||||
query.fields.filter((field) => field.memberId === "title").every((field) => field.binding.kind === "state"),
|
||||
);
|
||||
const broken = structuredClone(workspace);
|
||||
const facts = broken.interfaceImports.find((iface) => iface.displayName === "TaskFacts")!;
|
||||
const title = facts.members.find((member) => member.id === "title")!;
|
||||
assert.equal(title.kind, "value");
|
||||
delete title.queryRead;
|
||||
assert.throws(() => linkQueries(broken), /changed/);
|
||||
});
|
||||
Reference in New Issue
Block a user