test(kimi): share client configuration fixtures (#17349)

This commit is contained in:
Vincent Koc
2026-12-06 09:36:40 +08:00
committed by GitHub
parent 18e9f6d367
commit 8b2ca551c9
@@ -87,15 +87,17 @@ describe("Kimi Code configuration paths and skills", () => {
});
});
const kimiClientFixture = (prefix: string) => async () => {
const home = await createTestTempDirectory(prefix);
const client = kimiPath(home, process.platform, {});
if (client?.markerPath === undefined)
throw new Error("missing Kimi Code client");
await mkdir(client.markerPath, { recursive: true });
return { home, client } as const;
};
describe("Kimi Code registration lifecycle", () => {
const kimiClient = async () => {
const home = await createTestTempDirectory("rea-kimi-");
const client = kimiPath(home, process.platform, {});
if (client?.markerPath === undefined)
throw new Error("missing Kimi Code client");
await mkdir(client.markerPath, { recursive: true });
return { home, client };
};
const kimiClient = kimiClientFixture("rea-kimi-");
it("preserves the caller's enabledTools selection during refresh", async () => {
const { client } = await kimiClient();
@@ -232,14 +234,7 @@ describe("Kimi Code registration lifecycle", () => {
});
describe("Kimi Code input-schema profile selection", () => {
const kimiClient = async () => {
const home = await createTestTempDirectory("rea-kimi-schema-profile-");
const client = kimiPath(home, process.platform, {});
if (client?.markerPath === undefined)
throw new Error("missing Kimi Code client");
await mkdir(client.markerPath, { recursive: true });
return { home, client };
};
const kimiClient = kimiClientFixture("rea-kimi-schema-profile-");
it("refuses to preserve a stored removed full profile", async () => {
const { client } = await kimiClient();
@@ -344,14 +339,7 @@ describe("Kimi Code input-schema profile selection", () => {
});
describe("Kimi Code package launchers", () => {
const kimiClient = async () => {
const home = await createTestTempDirectory("rea-kimi-launcher-");
const client = kimiPath(home, process.platform, {});
if (client?.markerPath === undefined)
throw new Error("missing Kimi Code client");
await mkdir(client.markerPath, { recursive: true });
return { home, client } as const;
};
const kimiClient = kimiClientFixture("rea-kimi-launcher-");
it.each([
["npx", "linux"],
@@ -403,14 +391,7 @@ describe("Kimi Code package launchers", () => {
});
describe("Kimi Code transport validation", () => {
const kimiClient = async () => {
const home = await createTestTempDirectory("rea-kimi-validation-");
const client = kimiPath(home, process.platform, {});
if (client?.markerPath === undefined)
throw new Error("missing Kimi Code client");
await mkdir(client.markerPath, { recursive: true });
return { home, client };
};
const kimiClient = kimiClientFixture("rea-kimi-validation-");
it("creates a registration in a zero-byte file and accepts whitespace-only files", async () => {
const { home, client } = await kimiClient();
@@ -506,14 +487,7 @@ describe("Kimi Code transport validation", () => {
});
describe("Kimi Code timeout alignment", () => {
const kimiClient = async () => {
const home = await createTestTempDirectory("rea-kimi-timeout-");
const client = kimiPath(home, process.platform, {});
if (client?.markerPath === undefined)
throw new Error("missing Kimi Code client");
await mkdir(client.markerPath, { recursive: true });
return { home, client } as const;
};
const kimiClient = kimiClientFixture("rea-kimi-timeout-");
it.each([
["startupTimeoutMs", 1, "stale"],