Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions packages/core/src/catalog/catalog.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,104 @@ describe("catalog", () => {
});
});

describe("nodejs-backend option", () => {
it("has nodejs-backend option with skills for architecture, design, code, and testing", () => {
const catalog = getDefaultCatalog();
const architecture = getFacet(catalog, "architecture")!;
const nodejsBackend = getOption(architecture, "nodejs-backend");

expect(nodejsBackend).toBeDefined();
const skillsProvisions = nodejsBackend!.recipe.filter(
(p) => p.writer === "skills"
);
expect(skillsProvisions).toHaveLength(1);

const skills = (
skillsProvisions[0].config as { skills: { name: string }[] }
).skills;
const names = skills.map((s) => s.name);
expect(names).toContain("nodejs-backend-architecture");
expect(names).toContain("nodejs-backend-design");
expect(names).toContain("nodejs-backend-code");
expect(names).toContain("nodejs-backend-testing");
});

it("nodejs-backend option declares docsets for tRPC, Drizzle, Express, and Zod", () => {
const catalog = getDefaultCatalog();
const architecture = getFacet(catalog, "architecture")!;
const nodejsBackend = getOption(architecture, "nodejs-backend")!;

expect(nodejsBackend.docsets).toBeDefined();
const ids = nodejsBackend.docsets!.map((d) => d.id);
expect(ids).toContain("trpc-docs");
expect(ids).toContain("drizzle-orm-docs");
expect(ids).toContain("express-docs");
expect(ids).toContain("zod-docs");
});

it("each nodejs-backend docset has required fields", () => {
const catalog = getDefaultCatalog();
const architecture = getFacet(catalog, "architecture")!;
const nodejsBackend = getOption(architecture, "nodejs-backend")!;

for (const docset of nodejsBackend.docsets!) {
expect(docset.id).toBeTruthy();
expect(docset.label).toBeTruthy();
expect(docset.origin).toMatch(/^https:\/\//);
expect(docset.description).toBeTruthy();
}
});
});

describe("java-backend option", () => {
it("has java-backend option with skills for architecture, design, code, and testing", () => {
const catalog = getDefaultCatalog();
const architecture = getFacet(catalog, "architecture")!;
const javaBackend = getOption(architecture, "java-backend");

expect(javaBackend).toBeDefined();
const skillsProvisions = javaBackend!.recipe.filter(
(p) => p.writer === "skills"
);
expect(skillsProvisions).toHaveLength(1);

const skills = (
skillsProvisions[0].config as { skills: { name: string }[] }
).skills;
const names = skills.map((s) => s.name);
expect(names).toContain("java-backend-architecture");
expect(names).toContain("java-backend-design");
expect(names).toContain("java-backend-code");
expect(names).toContain("java-backend-testing");
});

it("java-backend option declares docsets for Spring Boot, Spring Data JPA, Spring Security, and Lombok", () => {
const catalog = getDefaultCatalog();
const architecture = getFacet(catalog, "architecture")!;
const javaBackend = getOption(architecture, "java-backend")!;

expect(javaBackend.docsets).toBeDefined();
const ids = javaBackend.docsets!.map((d) => d.id);
expect(ids).toContain("spring-boot-docs");
expect(ids).toContain("spring-data-jpa-docs");
expect(ids).toContain("spring-security-docs");
expect(ids).toContain("lombok-docs");
});

it("each java-backend docset has required fields", () => {
const catalog = getDefaultCatalog();
const architecture = getFacet(catalog, "architecture")!;
const javaBackend = getOption(architecture, "java-backend")!;

for (const docset of javaBackend.docsets!) {
expect(docset.id).toBeTruthy();
expect(docset.label).toBeTruthy();
expect(docset.origin).toMatch(/^https:\/\//);
expect(docset.description).toBeTruthy();
}
});
});

describe("architecture facet docsets", () => {
it("tanstack option declares docsets for Router, Query, Form, and Table", () => {
const catalog = getDefaultCatalog();
Expand Down
Loading