Rebasely Beta: data may be purged

examples/live-notes Public

TypeScript · 14 lines · 580 B · at 99dd857

import assert from "node:assert/strict";import { test } from "node:test";import { route } from "../src/routes.ts";test("routes a note and its socket", () => {  assert.deepEqual(route("/notes/groceries"), { kind: "note", id: "groceries" });  assert.deepEqual(route("/notes/team_standup-42/ws"), { kind: "socket", id: "team_standup-42" });});test("refuses other paths and odd ids", () => {  for (const p of ["/", "/notes", "/notes/", "/notes/a/b", "/notes/a%20b", "/notes/../x", `/notes/${"a".repeat(65)}`, "/notes/a/ws/x"]) {    assert.equal(route(p), null, p);  }});