Add explicit enterprise session commands

This commit is contained in:
gitea committed 2026-09-22 13:58:42 +08:00
1 parent 50a8beb3fd
commit 01ef5b37cb
10 files changed
+158 -25

No files matched your search

+33
View File
@@ -171,6 +171,30 @@ describe("corps link onboarding", () => {
expect(readDirectory(enterprises)).toEqual([]);
});
test("imports a normalized Hose web session and stores a temporary Seal session", async () => {
const enterprises = setupConfigEnv();
mockSealLinkRequests();
const result = await runCli([
"corps",
"add-hose-web-session",
"--json",
JSON.stringify({
baseUrl: "https://wx2.ekuaibao.com",
corpId: "Acme-01",
accessToken: "hose-token"
})
]);
expect(result.isError).toBe(false);
expect(result.exitCode).toBe(0);
const config = JSON.parse(readFileSync(join(enterprises, "acme-01.json"), "utf-8"));
expect(config.source.type).toBe("seal");
expect(config.source.provider).toBe("hosecloud");
expect(config.source.token).toBe("seal-bearer-token");
expect(config.source.expiresIn).toBe(1800);
});
test("rejects --elevate-hose when passed with a Seal native delegate link", async () => {
mockSealLinkRequests();
@@ -204,6 +228,15 @@ describe("corp compatibility alias", () => {
expect(result.stderr).not.toContain("Unknown corps action");
});
test("exposes add-seal-bearer as the canonical Seal onboarding command", async () => {
setupConfigEnv();
const result = await runCli(["corps", "add-seal-bearer", "--json", "{}"]);
expect(result.isError).toBe(true);
expect(result.stderr).toContain("Missing required JSON field: token");
expect(result.stderr).not.toContain("Unknown corps action");
});
test("seal-use corp list executes and resolves cleanly like seal-use corps", async () => {
setupConfigEnv();
const result = await runCli(["corp", "list"]);