WIP! A BB-style forum, on the ATmosphere! We're still working... we'll be back soon when we have something to show off!
node typescript hono htmx atproto
at root/atb-56-theme-caching-layer 40 lines 1.2 kB view raw
1import { describe, it, expect } from "vitest"; 2import { checkEnvironment } from "../lib/preflight.js"; 3import type { CliConfig } from "../lib/config.js"; 4 5describe("checkEnvironment", () => { 6 it("returns success when all required vars are present", () => { 7 const config: CliConfig = { 8 databaseUrl: "postgres://localhost/atbb", 9 forumDid: "did:plc:test", 10 pdsUrl: "https://bsky.social", 11 forumHandle: "forum.example.com", 12 forumPassword: "secret", 13 missing: [], 14 }; 15 16 const result = checkEnvironment(config); 17 18 expect(result.ok).toBe(true); 19 expect(result.errors).toHaveLength(0); 20 }); 21 22 it("returns errors when required vars are missing", () => { 23 const config: CliConfig = { 24 databaseUrl: "", 25 forumDid: "", 26 pdsUrl: "https://bsky.social", 27 forumHandle: "", 28 forumPassword: "", 29 missing: ["DATABASE_URL", "FORUM_DID", "FORUM_HANDLE", "FORUM_PASSWORD"], 30 }; 31 32 const result = checkEnvironment(config); 33 34 expect(result.ok).toBe(false); 35 expect(result.errors).toContain("DATABASE_URL"); 36 expect(result.errors).toContain("FORUM_DID"); 37 expect(result.errors).toContain("FORUM_HANDLE"); 38 expect(result.errors).toContain("FORUM_PASSWORD"); 39 }); 40});