Skip to content

gitflarePublicPartly agent-ready50

cf-durable-whiteboard

Realtime collaborative whiteboard on Cloudflare Durable Objects: presence cursors, WebSocket hibernation, SQLite storage, undo, PNG export.

Keep board zoom and pan stable across reloads6eb4fbd
TypeScript17 lines761 B
import { describe, it, expect, vi } from "vitest"; vi.mock("cloudflare:workers", () => ({ DurableObject: class { constructor(public ctx: any, public env: any) {} } }));const { default: worker } = await import("../src/index"); describe("deep links", () => {  it("serves board shell without .html", async () => {    const paths: string[] = [];    const env = { BOARD: {}, ASSETS: { fetch: async (r: Request) => { paths.push(new URL(r.url).pathname); return new Response("shell"); } } } as any;    const r = await worker.fetch(new Request("https://x/b/abcd2345"), env);    expect(r.status).toBe(200);    expect(await r.text()).toBe("shell");    expect(paths).toEqual(["/board"]);    expect(paths.some((p) => p.endsWith(".html"))).toBe(false);  });});