first commit

This commit is contained in:
Matt Kane
2026-04-01 10:44:22 +01:00
commit 43fcb9a131
1789 changed files with 395041 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: "@emdashcms/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: "@emdashcms/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" });
});
});