Files
rea/tests/boundary/filesystem/qoderClientConfiguration.test.ts
morluto 23de10bb28 fix: streamline tests and preserve Darwin process ownership (#8275)
* test: strengthen suite guards and regression oracles

* test: share JSON client registration contract

* test: reuse fixtures and reduce repeated setup

* fix(process): preserve ambiguous Darwin token ownership

* test(process): bound child readiness waits
2026-10-31 16:43:04 +08:00

69 lines
2.4 KiB
TypeScript

import { join } from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { skillDestinations } from "../../../src/application/SetupSkill.js";
import { supportedClients } from "../../../src/application/SupportedClients.js";
import { clearClientLocationEnvironment } from "../../fixtures/clientEnvironment.js";
import { jsonClientRegistrationContract } from "../../support/jsonClientRegistrationContract.js";
beforeEach(clearClientLocationEnvironment);
afterEach(() => vi.unstubAllEnvs());
const qoderPath = (
home: string,
platform: NodeJS.Platform = "linux",
env: Parameters<typeof supportedClients>[2] = {},
) => supportedClients(home, platform, env).find(({ name }) => name === "qoder");
describe("Qoder configuration paths", () => {
it("resolves the user settings file and marker directory", () => {
expect(qoderPath("/home/a")).toEqual({
name: "qoder",
displayName: "Qoder",
configPath: join("/home/a", ".qoder", "settings.json"),
markerPath: join("/home/a", ".qoder"),
format: "json",
});
expect(qoderPath("/Users/a", "darwin")?.configPath).toBe(
join("/Users/a", ".qoder", "settings.json"),
);
expect(qoderPath("C:\\Users\\a", "win32")?.configPath).toBe(
join("C:\\Users\\a", ".qoder", "settings.json"),
);
});
it("honors the QODER_CONFIG_DIR override", () => {
expect(
qoderPath("/home/a", "linux", { QODER_CONFIG_DIR: "/opt/qoder" })
?.configPath,
).toBe(join("/opt/qoder", "settings.json"));
expect(
qoderPath("/home/a", "linux", { QODER_CONFIG_DIR: "" })?.configPath,
).toBe(join("/home/a", ".qoder", "settings.json"));
});
it("resolves the personal skills directory beside the config root", () => {
expect(
skillDestinations("/home/a", ["qoder"]).map(({ path }) => path),
).toEqual([
join("/home/a", ".qoder", "skills", "reverse-engineer-anything"),
]);
expect(
skillDestinations("/home/a", ["qoder"], {
QODER_CONFIG_DIR: "/opt/qoder",
}).map(({ path }) => path),
).toEqual([join("/opt/qoder", "skills", "reverse-engineer-anything")]);
});
});
jsonClientRegistrationContract({
clientName: "qoder",
displayName: "Qoder",
directory: ".qoder",
filename: "settings.json",
initialSettings: { model: { name: "qoder-model" } },
settingsWithoutServers: { general: { vimMode: false } },
});