Files
kunthawat 2d1be52177 Emdash source with visual editor image upload fix
Fixes:
1. media.ts: wrap placeholder generation in try-catch
2. toolbar.ts: check r.ok, display error message in popover
2026-05-03 10:44:54 +07:00

36 lines
1.1 KiB
TypeScript

import { describe, it, expect } from "vitest";
import { previewDatabase, playgroundDatabase } from "../src/index.js";
describe("previewDatabase()", () => {
it("returns a sqlite DatabaseDescriptor with the DO entrypoint", () => {
const result = previewDatabase({ binding: "PREVIEW_DB" });
expect(result).toEqual({
entrypoint: "@emdash-cms/cloudflare/db/do",
config: { binding: "PREVIEW_DB" },
type: "sqlite",
});
});
it("passes binding through to config", () => {
const result = previewDatabase({ binding: "MY_PREVIEW" });
expect(result.config).toEqual({ binding: "MY_PREVIEW" });
});
});
describe("playgroundDatabase()", () => {
it("returns a sqlite DatabaseDescriptor with the playground entrypoint", () => {
const result = playgroundDatabase({ binding: "PLAYGROUND_DB" });
expect(result).toEqual({
entrypoint: "@emdash-cms/cloudflare/db/playground",
config: { binding: "PLAYGROUND_DB" },
type: "sqlite",
});
});
it("passes binding through to config", () => {
const result = playgroundDatabase({ binding: "MY_PLAYGROUND" });
expect(result.config).toEqual({ binding: "MY_PLAYGROUND" });
});
});