src/utils/templates.test.ts 963 B raw
1
import { describe, it, expect } from "bun:test";
2
import { TEMPLATES, honoRpcTemplate, honoClientTemplate } from "./templates";
3
4
describe("Templates", () => {
5
	it("should have all required templates with correct structure", () => {
6
		const expectedTemplates = ["default", "tailwind", "shadcn"];
7
8
		expectedTemplates.forEach((templateName) => {
9
			expect(TEMPLATES).toHaveProperty(templateName);
10
			const template = TEMPLATES[templateName];
11
			expect(template).toHaveProperty("branch");
12
			expect(template).toHaveProperty("description");
13
			expect(typeof template?.branch).toBe("string");
14
			expect(typeof template?.description).toBe("string");
15
		});
16
	});
17
18
	it("should have valid Hono templates", () => {
19
		expect(honoRpcTemplate).toContain("import { Hono }");
20
		expect(honoRpcTemplate).toContain("export const app = new Hono()");
21
22
		expect(honoClientTemplate).toContain("import { hc }");
23
		expect(honoClientTemplate).toContain("export const hcWithType");
24
	});
25
});