Initial Schemeta MVP compiler and API
This commit is contained in:
commit
61814349ed
10 files changed
+1003
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { compile } from "../src/compile.js";
|
||||
import fixture from "../examples/esp32-audio.json" with { type: "json" };
|
||||
|
||||
test("compile returns svg and topology for valid model", () => {
|
||||
const result = compile(fixture);
|
||||
assert.equal(result.ok, true);
|
||||
assert.ok(result.svg.includes("<svg"));
|
||||
assert.ok(result.topology.power_domains.includes("3V3"));
|
||||
assert.ok(result.topology.clock_sources.includes("U1"));
|
||||
});
|
||||
|
||||
test("compile fails on invalid model", () => {
|
||||
const bad = { symbols: {}, instances: [], nets: [] };
|
||||
const result = compile(bad);
|
||||
assert.equal(result.ok, false);
|
||||
assert.ok(result.errors.length > 0);
|
||||
});
|
||||
Reference in new issue
Block a user