Reorganize repo structure and standards references
This commit is contained in:
1 parent
3cb93a81be
commit
be2054274d
5885 files changed
+2588
-195
No files matched your search
@@ -0,0 +1,51 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { addCommand, auditCommand, backupCommand, createCommand, mainCommand, opsCommand } from "./index.js";
|
||||
|
||||
async function resolveValue<T>(value: T | (() => T) | (() => Promise<T>)): Promise<T> {
|
||||
if (typeof value === "function") {
|
||||
return await (value as () => T | Promise<T>)();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
describe("cli main command", () => {
|
||||
it("exposes the backup subcommand tree", async () => {
|
||||
const mainMeta = await resolveValue(mainCommand.meta);
|
||||
expect(mainMeta).toMatchObject({ name: "toolctrl-cli" });
|
||||
|
||||
const backupMeta = await resolveValue(backupCommand.meta);
|
||||
expect(backupMeta).toMatchObject({ name: "backup" });
|
||||
|
||||
const backupSubCommands = await resolveValue(backupCommand.subCommands);
|
||||
expect(Object.keys(backupSubCommands ?? {}).sort()).toEqual(["create", "list", "restore", "rotate", "verify"]);
|
||||
});
|
||||
|
||||
it("registers the create + add scaffolding groups", async () => {
|
||||
const subs = await resolveValue(mainCommand.subCommands);
|
||||
const keys = Object.keys(subs ?? {});
|
||||
expect(keys).toContain("create");
|
||||
expect(keys).toContain("add");
|
||||
|
||||
const createSubs = await resolveValue(createCommand.subCommands);
|
||||
expect(Object.keys(createSubs ?? {}).sort()).toEqual(["entity", "module", "route"]);
|
||||
|
||||
const addSubs = await resolveValue(addCommand.subCommands);
|
||||
expect(Object.keys(addSubs ?? {}).sort()).toEqual(["event-type", "hook", "permission"]);
|
||||
});
|
||||
|
||||
it("registers the ops command group with doctor / migrate-tenant / impersonate", async () => {
|
||||
const subs = await resolveValue(mainCommand.subCommands);
|
||||
expect(Object.keys(subs ?? {})).toContain("ops");
|
||||
|
||||
const opsSubs = await resolveValue(opsCommand.subCommands);
|
||||
expect(Object.keys(opsSubs ?? {}).sort()).toEqual(["doctor", "impersonate", "migrate-tenant"]);
|
||||
});
|
||||
|
||||
it("registers the audit command group with verify-chain / export-pdf", async () => {
|
||||
const subs = await resolveValue(mainCommand.subCommands);
|
||||
expect(Object.keys(subs ?? {})).toContain("audit");
|
||||
|
||||
const auditSubs = await resolveValue(auditCommand.subCommands);
|
||||
expect(Object.keys(auditSubs ?? {}).sort()).toEqual(["export-pdf", "verify-chain"]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user