Skip to content

Commit a0b4666

Browse files
committed
refactor(e2e): remove outdated token-plan tests and add new route exports
- Deleted the `token-plan.e2e.test.ts` file as it contained outdated test cases. - Introduced `TOKEN_PLAN_ROUTES` in `topic-routes.ts` to define new command routes for token-plan operations. - This update streamlines the E2E testing structure and prepares for future enhancements.
1 parent e8666b3 commit a0b4666

2 files changed

Lines changed: 34 additions & 13 deletions

File tree

packages/cli/tests/e2e/token-plan.e2e.test.ts renamed to packages/commands/tests/e2e/token-plan.e2e.test.ts

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
import { describe, expect, test } from "vite-plus/test";
2-
import { makeE2eOutputDir, parseStdoutJson, runCli } from "./helpers.ts";
2+
import { makeE2eOutputDir, parseStdoutJson, runCommandE2e } from "./helpers.ts";
3+
import { TOKEN_PLAN_ROUTES } from "./topic-routes.ts";
34

45
describe("e2e: token-plan", () => {
56
test("token-plan help shows centralized OpenAPI auth flags", async () => {
6-
const { stderr, exitCode } = await runCli(["token-plan", "list-seats", "--help"]);
7+
const { stderr, exitCode } = await runCommandE2e(TOKEN_PLAN_ROUTES, [
8+
"token-plan",
9+
"list-seats",
10+
"--help",
11+
]);
712
expect(exitCode, stderr).toBe(0);
813
expect(stderr).toMatch(/--access-key-id/);
914
expect(stderr).toMatch(/--access-key-secret/);
1015
});
1116

1217
test("token-plan dry-run does not require OpenAPI AK/SK", async () => {
13-
const { stdout, stderr, exitCode } = await runCli(
18+
const { stdout, stderr, exitCode } = await runCommandE2e(
19+
TOKEN_PLAN_ROUTES,
1420
["token-plan", "list-seats", "--dry-run", "--output", "json"],
1521
{
1622
ALIBABA_CLOUD_ACCESS_KEY_ID: "",
@@ -25,22 +31,30 @@ describe("e2e: token-plan", () => {
2531

2632
test("token-plan non-dry-run requires OpenAPI AK/SK", async () => {
2733
const configDir = makeE2eOutputDir("token-plan-missing-openapi");
28-
const { stderr, exitCode } = await runCli(["token-plan", "list-seats"], {
29-
BAILIAN_CONFIG_DIR: configDir,
30-
ALIBABA_CLOUD_ACCESS_KEY_ID: "",
31-
ALIBABA_CLOUD_ACCESS_KEY_SECRET: "",
32-
});
34+
const { stderr, exitCode } = await runCommandE2e(
35+
TOKEN_PLAN_ROUTES,
36+
["token-plan", "list-seats"],
37+
{
38+
BAILIAN_CONFIG_DIR: configDir,
39+
ALIBABA_CLOUD_ACCESS_KEY_ID: "",
40+
ALIBABA_CLOUD_ACCESS_KEY_SECRET: "",
41+
},
42+
);
3343
expect(exitCode).not.toBe(0);
3444
expect(stderr).toMatch(/OpenAPI AK\/SK|access-key-id|ALIBABA_CLOUD_ACCESS_KEY_ID/);
3545
});
3646

3747
test("token-plan partial OpenAPI env reports AK/SK hint without API key onboarding", async () => {
3848
const configDir = makeE2eOutputDir("token-plan-partial-openapi-env");
39-
const { stderr, exitCode } = await runCli(["token-plan", "list-seats"], {
40-
BAILIAN_CONFIG_DIR: configDir,
41-
ALIBABA_CLOUD_ACCESS_KEY_ID: "ak-e2e-placeholder",
42-
ALIBABA_CLOUD_ACCESS_KEY_SECRET: "",
43-
});
49+
const { stderr, exitCode } = await runCommandE2e(
50+
TOKEN_PLAN_ROUTES,
51+
["token-plan", "list-seats"],
52+
{
53+
BAILIAN_CONFIG_DIR: configDir,
54+
ALIBABA_CLOUD_ACCESS_KEY_ID: "ak-e2e-placeholder",
55+
ALIBABA_CLOUD_ACCESS_KEY_SECRET: "",
56+
},
57+
);
4458
expect(exitCode).not.toBe(0);
4559
expect(stderr).toMatch(/Incomplete OpenAPI AK\/SK/);
4660
expect(stderr).toMatch(/ALIBABA_CLOUD_ACCESS_KEY_ID/);

packages/commands/tests/e2e/topic-routes.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,10 @@ export const CONSOLE_FLAGS_DRY_RUN_ROUTES: E2eRouteExports = {
136136
"mcp list": "mcpList",
137137
"quota check": "quotaCheck",
138138
};
139+
140+
export const TOKEN_PLAN_ROUTES: E2eRouteExports = {
141+
"token-plan list-seats": "tokenPlanListSeats",
142+
"token-plan create-key": "tokenPlanCreateKey",
143+
"token-plan assign-seats": "tokenPlanAssignSeats",
144+
"token-plan add-member": "tokenPlanAddMember",
145+
};

0 commit comments

Comments
 (0)