diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_dashboard.mjs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/test_dashboard.mjs b/tests/test_dashboard.mjs index 2fc19eb..dac4e5b 100644 --- a/tests/test_dashboard.mjs +++ b/tests/test_dashboard.mjs @@ -15,7 +15,7 @@ // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. import assert from "node:assert/strict"; -import { area, push, spendParts, batteryGlyph, HISTORY } from "../static/dashboard.js"; +import { area, line, push, spendParts, batteryGlyph, HISTORY } from "../static/dashboard.js"; import { busy as printing } from "../static/modules/k1c.js"; import { busy as building } from "../static/modules/sbbuilder.js"; import { busy as live } from "../static/modules/obs.js"; @@ -32,6 +32,11 @@ const d = area([0, 10], 10); assert.match(d, /^M[\d.]+,100 /); assert.match(d, / L120,100 Z$/); assert.ok(d.includes(",12"), "the max sample sits at 12% from the top"); +// line: the same samples, open, so no bottom or side edge is stroked +assert.equal(line([], 10), ""); +const l = line([0, 10], 10); +assert.match(l, /^M[\d.]+,100 L120,12$/); +assert.ok(d.includes(l.slice(1)), "area follows line"); // spendParts: top 3 paid models, then "other" with the rest const models = [5, 4, 3, 2, 1, 0].map((c, i) => ({ model: `m${i}`, cost: c })); |
