test(cli): main subcommands list
This commit is contained in:
parent
c1e2ed579c
commit
17f631baaf
3 changed files with 18 additions and 1 deletions
|
@ -11,5 +11,6 @@
|
|||
"cli": "node ./packages/cli",
|
||||
"patch:all": "npm version patch -w @mcflyjs/cli && npm version patch -w @mcflyjs/core && npm version patch -w @mcflyjs/config && npm version patch -w create-mcfly",
|
||||
"test:cli": "cd packages/cli && pnpm run test"
|
||||
}
|
||||
},
|
||||
"packageManager": "pnpm@9.15.0+sha512.76e2379760a4328ec4415815bcd6628dee727af3779aaa4c914e3944156c4299921a89f976381ee107d41f12cfa4b66681ca9c718f0668fa0831ed4c6d8ba56c"
|
||||
}
|
||||
|
|
|
@ -17,3 +17,7 @@ const main = defineCommand({
|
|||
});
|
||||
|
||||
runMain(main);
|
||||
|
||||
export const exportedForTest = {
|
||||
main,
|
||||
};
|
||||
|
|
12
packages/cli/test/index.test.js
Normal file
12
packages/cli/test/index.test.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { test } from "vitest";
|
||||
import { exportedForTest } from "..";
|
||||
import { expect } from "vitest";
|
||||
|
||||
const testObj = exportedForTest.main;
|
||||
|
||||
test("should have correct subcommands", () => {
|
||||
Object.keys(testObj.subCommands).forEach((key) => {
|
||||
expect(testObj.subCommands[key]).toBeTypeOf("function");
|
||||
expect(testObj.subCommands[key].name).toBe(key);
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue