feat: add cloudflare workers deployment

This commit is contained in:
Codex
2026-06-21 23:43:02 +08:00
parent 2fc34979f4
commit 44e9e04533
35 changed files with 8343 additions and 121 deletions
+39
View File
@@ -0,0 +1,39 @@
import { mkdtempSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { createSqliteRepository } from "../sqlite-repository";
describe("createSqliteRepository", () => {
let tempDir: string;
let dbPath: string;
beforeEach(() => {
tempDir = mkdtempSync(join(tmpdir(), "geo-repository-"));
dbPath = join(tempDir, "app.db");
});
afterEach(() => {
rmSync(tempDir, { recursive: true, force: true });
});
test("creates and reads an article job through the async repository interface", async () => {
const repository = createSqliteRepository(dbPath);
const job = await repository.createArticleJob({
source_title: "Title",
source_body: "Body",
image_inputs: [],
publish_platform: "official_site",
user_instructions: "",
});
await expect(repository.getArticleJob(job.id)).resolves.toMatchObject({
id: job.id,
source_title: "Title",
export_paths: {},
});
});
});