feat(web): render canonical living hedge maze walls
This commit is contained in:
@@ -6,6 +6,8 @@ const zlib = require("node:zlib");
|
||||
|
||||
const samplePath = path.join(__dirname, "..", "..", "docs", "hedge-sample-library.svg");
|
||||
const sample = fs.readFileSync(samplePath, "utf8");
|
||||
const runtimePath = path.join(__dirname, "..", "..", "web", "hedges.svg");
|
||||
const runtime = fs.readFileSync(runtimePath, "utf8");
|
||||
|
||||
test("hedge review sheet is local editable SVG with complete stable symbols", () => {
|
||||
assert.match(sample, /^<svg xmlns="http:\/\/www\.w3\.org\/2000\/svg"/);
|
||||
@@ -25,3 +27,19 @@ test("hedge review sheet is local editable SVG with complete stable symbols", ()
|
||||
assert.ok((sample.match(/<use href=/g) || []).length >= 20);
|
||||
assert.ok(zlib.gzipSync(sample, {level: 9}).length < sample.length);
|
||||
});
|
||||
|
||||
test("runtime hedge sprite remains local and contains approved runtime symbols", () => {
|
||||
assert.match(runtime, /^<svg xmlns="http:\/\/www\.w3\.org\/2000\/svg"/);
|
||||
assert.doesNotMatch(runtime, /<(?:script|image|foreignObject|metadata)\b/i);
|
||||
assert.doesNotMatch(runtime, /(?:href="https?:|url\(|data:|@import|<style\b)/i);
|
||||
for (const identifier of [
|
||||
"hedge-intact-1", "hedge-intact-2", "hedge-intact-3", "hedge-intact-4",
|
||||
"hedge-intact-5", "hedge-intact-6", "hedge-impact-1", "hedge-impact-2",
|
||||
"hedge-impact-3", "hedge-impact-4", "hedge-breakthrough", "hedge-breach-1",
|
||||
"hedge-breach-2", "hedge-breach-3"
|
||||
]) {
|
||||
assert.match(runtime, new RegExp(`id="${identifier}"`));
|
||||
assert.match(sample, new RegExp(`id="${identifier}"`));
|
||||
}
|
||||
assert.ok(zlib.gzipSync(runtime, {level: 9}).length < 4096);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user