Fix Hose web-session source persistence

This commit is contained in:
gitea committed 2026-09-22 14:15:40 +08:00
1 parent 2e941f0842
commit 1987b45336
14 files changed
+518 -316

No files matched your search

+12 -12
View File
@@ -26,7 +26,7 @@ afterEach(() => {
});
describe("corps link onboarding", () => {
test("imports a Hose assistance link and writes a verified Seal config", async () => {
test("imports a Hose assistance link and writes a verified Hose web-session config", async () => {
const enterprises = setupConfigEnv();
mockSealLinkRequests();
@@ -43,8 +43,8 @@ describe("corps link onboarding", () => {
seal: { url?: string; tenantSlug?: string };
source: {
type: string;
token: string;
expiresIn: number;
closeToken: string;
staffId: string;
provider?: string;
corpId?: string;
};
@@ -57,9 +57,9 @@ describe("corps link onboarding", () => {
tenantSlug: "acme-01"
},
source: {
type: "seal",
token: "seal-bearer-token",
expiresIn: 1800,
type: "hose",
closeToken: "hose-token",
staffId: "acme-01:admin",
provider: "hosecloud",
corpId: "acme-01"
}
@@ -171,7 +171,7 @@ describe("corps link onboarding", () => {
expect(readDirectory(enterprises)).toEqual([]);
});
test("imports a normalized Hose web session and stores a temporary Seal session", async () => {
test("imports a normalized Hose web session and stores the Hose source", async () => {
const enterprises = setupConfigEnv();
mockSealLinkRequests();
@@ -182,18 +182,18 @@ describe("corps link onboarding", () => {
JSON.stringify({
baseUrl: "https://wx2.ekuaibao.com",
corpId: "Acme-01",
accessToken: "hose-token"
accessToken: "hose-token",
staffId: "staff-1"
})
]);
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.type).toBe("hose");
expect(config.source.provider).toBe("hosecloud");
expect(config.source.token).toBe("seal-bearer-token");
expect(config.source.expiresIn).toBe(1800);
expect(config.source.expiresAt).toMatch(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/);
expect(config.source.closeToken).toBe("hose-token");
expect(config.source.staffId).toBe("staff-1");
});
test("rejects --elevate-hose when passed with a Seal native delegate link", async () => {