feat: add application productivity foundations
Quality / quality (ubuntu-latest) (push) Failing after 22s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-23 11:13:03 +05:30
parent 46195462c3
commit 64ab20cc95
42 changed files with 1533 additions and 40 deletions
+13 -1
View File
@@ -1,5 +1,5 @@
import { test, expect } from "bun:test";
import { scaffold } from "../src/generate.ts";
import { scaffold, scaffoldResource } from "../src/generate.ts";
test("scaffold page: kebab file, PascalCase page name", () => {
const f = scaffold("page", "about-us");
@@ -32,3 +32,15 @@ test("scaffold strips extensions from the given name", () => {
expect(scaffold("page", "home.wrn").path).toBe("pages/home.wrn");
expect(scaffold("api", "ping.ts").path).toBe("api/ping.ts");
});
test("resource scaffold emits schema, handlers, routes and a page", () => {
const files = scaffoldResource("templates");
expect(files.map((file) => file.path)).toEqual([
"schemas/template.ts",
"resources/templates.ts",
"api/templates.ts",
"api/templates/[id].ts",
"pages/templates.wrn",
]);
expect(files[1]?.content).toContain("defineResource");
});