Make Camino examples and scaffolds complete Yarn and Nix packages
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { componentEntries } from "../src/capability-language/component-nix.js";
|
||||
test("component edit surface parses literal Nix without evaluating arbitrary expressions", async () => {
|
||||
assert.deepEqual(
|
||||
{
|
||||
...(await componentEntries(
|
||||
`{\n # retained author comment\n "component:card" = { export = "Card"; entry = "src/card.tsx"; };\n}\n`,
|
||||
)),
|
||||
},
|
||||
{ "component:card": { entry: "src/card.tsx", export: "Card" } },
|
||||
);
|
||||
await assert.rejects(
|
||||
componentEntries('let x = builtins.abort "must not evaluate"; in x'),
|
||||
/supported literal-entry shape|literal strings|supported scaffold shape/,
|
||||
);
|
||||
await assert.rejects(
|
||||
componentEntries(
|
||||
'{\n "component:card" = { entry = "${builtins.abort "must not evaluate"}"; export = "Card"; };\n}\n',
|
||||
),
|
||||
/literal strings|supported literal-entry shape/,
|
||||
);
|
||||
await assert.rejects(
|
||||
componentEntries('{\n "component:card" = { entry = "src/card.tsx"; export = "Card"; extra = true; };\n}\n'),
|
||||
/Unsupported component entry property/,
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user