@ilaomianyang/dsh-memory-graph 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -1
- package/README.en.md +33 -2
- package/README.md +33 -2
- package/package.json +4 -2
- package/src/graph.js +1585 -1582
- package/test/page.mjs +17 -0
package/test/page.mjs
CHANGED
|
@@ -72,6 +72,23 @@ await check('it is the same renderer the vault writes to disk', async () => {
|
|
|
72
72
|
assert.equal(skeleton(served), skeleton(onDisk))
|
|
73
73
|
})
|
|
74
74
|
|
|
75
|
+
await check('every node carries the numbers the renderer multiplies', async () => {
|
|
76
|
+
const handler = createPageHandler({ getVault: () => vault })
|
|
77
|
+
const html = await (await handler()).text()
|
|
78
|
+
// The halo is drawn at r * haloScale. haloScale was computed in the model and
|
|
79
|
+
// then left out of the payload, so the browser multiplied by undefined, every
|
|
80
|
+
// halo became <circle r="NaN">, and the glow never appeared — one console
|
|
81
|
+
// error per node, invisible in a screenshot. Assert the payload, and assert
|
|
82
|
+
// the page never renders the word at all.
|
|
83
|
+
const data = JSON.parse(html.match(/var DATA = (\{.*\})/)[1])
|
|
84
|
+
assert.ok(data.nodes.length > 0, 'the fixture wrote a card, so there is a node')
|
|
85
|
+
for (const node of data.nodes) {
|
|
86
|
+
assert.ok(Number.isFinite(node.r), `${node.key} has a numeric radius`)
|
|
87
|
+
assert.ok(Number.isFinite(node.haloScale), `${node.key} carries the halo scale the renderer multiplies by`)
|
|
88
|
+
}
|
|
89
|
+
assert.ok(!html.includes('NaN'), 'no attribute is rendered as NaN')
|
|
90
|
+
})
|
|
91
|
+
|
|
75
92
|
await check('the page is frameable by its own origin and nothing else', async () => {
|
|
76
93
|
const handler = createPageHandler({ getVault: () => vault })
|
|
77
94
|
const response = await handler()
|