first commit
This commit is contained in:
35
packages/cloudflare/tests/do-config.test.ts
Normal file
35
packages/cloudflare/tests/do-config.test.ts
Normal 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" });
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user