30 lines
1.3 KiB
TypeScript
30 lines
1.3 KiB
TypeScript
import { expect, test } from "bun:test";
|
|
import { App } from "../index.ts";
|
|
import { resolveConfig } from "../core/config.ts";
|
|
import { createViews } from "../views/api.ts";
|
|
import { amezingIntegration, amezingStyles, accentStyle } from "../modules/amezing/index.ts";
|
|
|
|
function createAmezingApp() {
|
|
const views = createViews({ viewsDir: process.cwd() });
|
|
return App.create({ config: resolveConfig(), views, integrations: [amezingIntegration()] });
|
|
}
|
|
|
|
test("amezing integration mounts the theme components and assets", async () => {
|
|
const app = await createAmezingApp();
|
|
const response = await app.fetch(new Request("https://example.test/_muddle/amezing/closable.js"));
|
|
expect(response.status).toBe(200);
|
|
const font = await app.fetch(new Request("https://example.test/fonts/commissioner.woff2"));
|
|
expect(font.status).toBe(200);
|
|
const styles = await app.fetch(new Request("https://example.test/_muddle/amezing.css"));
|
|
expect((await styles.text()).length).toBeGreaterThan(0);
|
|
});
|
|
|
|
test("amezing accent colors map presets to inline variables", () => {
|
|
expect(accentStyle("purple")).toContain("--accent-light-h:254.11766");
|
|
expect(accentStyle(["red", "green"])).toContain("--accent-dark-h:90");
|
|
expect(() => accentStyle("nope")).toThrow();
|
|
});
|
|
|
|
test("amezing ships the compiled theme stylesheet", async () => {
|
|
expect(await amezingStyles()).toContain("#site-header");
|
|
});
|