* feat(draw-image): add SVG template render engine * feat(draw-image): add opencode plugin and tool tests * test(draw-image): add vitest unit integration e2e suite * chore(draw-image): wire CI dependabot docs and ADR * docs(handoff): set PR number * docs(handoff): fix PR number placeholder in frontmatter * fix(ci): use tempfile and trailing newline in draw-image tests --------- Co-authored-by: opencode-agent <agent@opencode.local>
42 lines
No EOL
1.4 KiB
TypeScript
42 lines
No EOL
1.4 KiB
TypeScript
import { describe, test, expect } from "vitest"
|
|
import { validateBrand } from "../src/config"
|
|
|
|
describe("config — validateBrand", () => {
|
|
test("valid brand passes", () => {
|
|
const brand = validateBrand({
|
|
base: "#0a0a0a",
|
|
surface: "#121212",
|
|
fg: "#ededed",
|
|
muted: "#a1a1aa",
|
|
accent: "#ccff00",
|
|
line: "rgba(255,255,255,0.06)",
|
|
})
|
|
expect(brand.accent).toBe("#ccff00")
|
|
expect(brand.base).toBe("#0a0a0a")
|
|
})
|
|
|
|
test("missing accent rejected", () => {
|
|
expect(() => validateBrand({ base: "#0a0a0a", surface: "#121212", fg: "#ededed", muted: "#a1a1aa" }))
|
|
.toThrow(/accent/)
|
|
})
|
|
|
|
test("non-hex accent rejected", () => {
|
|
expect(() => validateBrand({ base: "#0a0a0a", surface: "#121212", fg: "#ededed", muted: "#a1a1aa", accent: "green" }))
|
|
.toThrow(/hex/)
|
|
})
|
|
|
|
test("short hex rejected", () => {
|
|
expect(() => validateBrand({ base: "#0a0", surface: "#121212", fg: "#ededed", muted: "#a1a1aa", accent: "#ccff00" }))
|
|
.toThrow(/hex/)
|
|
})
|
|
|
|
test("non-object rejected", () => {
|
|
expect(() => validateBrand("not an object")).toThrow(/object/)
|
|
expect(() => validateBrand(null)).toThrow(/object/)
|
|
})
|
|
|
|
test("line defaults when missing", () => {
|
|
const brand = validateBrand({ base: "#0a0a0a", surface: "#121212", fg: "#ededed", muted: "#a1a1aa", accent: "#ccff00" })
|
|
expect(brand.line).toBe("rgba(255,255,255,0.06)")
|
|
})
|
|
}) |