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
This commit is contained in:
2026-05-03 10:44:54 +07:00
parent 78f81bebb6
commit 2d1be52177
2352 changed files with 662964 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
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" });
});
});