test: cover normal behavior and edge cases
GBB Demo authored on Nov 2, 2026
parent 322732ccommit dffc3183f84b
2 files changed, +19 −0
- package.json+9 −0@@ -1,0 +1,9 @@1+{2+ "name": "pulse-status",3+ "version": "0.1.0",4+ "private": true,5+ "type": "module",6+ "scripts": {7+ "test": "node test.mjs"8+ }9+}
- test.mjs+10 −0@@ -1,0 +1,10 @@1+import assert from "node:assert/strict";2+import * as app from "./app.mjs";3+4+assert.equal(app.overallStatus([]), "unknown");5+assert.equal(app.overallStatus([{status: "operational"}, {status: "outage"}]), "outage");6+assert.equal(app.uptime(999, 1000), 99.9);7+assert.equal(app.uptime(0, 0), null);8+assert.throws(() => app.uptime(2, 1));9+10+console.log("All checks passed");