Spracherkennung für: .ts vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]
import { describe, expect, it } from "vitest";
import {
formatConfigPath,
resolveConfigPathTarget,
stripUnknownConfigKeys,
} from "./doctor-config-analysis.js";
describe("doctor config analysis helpers", () => {
it("formats config paths predictably", () => {
expect(formatConfigPath([])).toBe("<root>");
expect(formatConfigPath(["channels", "slack", "accounts", 0, "token"])).toBe(
"channels.slack.accounts[0].token",
);
});
it("resolves nested config targets without throwing", () => {
const target = resolveConfigPathTarget(
{ channels: { slack: { accounts: [{ token: "x" }] } } },
["channels", "slack", "accounts", 0],
);
expect(target).toEqual({ token: "x" });
expect(resolveConfigPathTarget({ channels: null }, ["channels", "slack"])).toBeNull();
});
it("strips unknown config keys while keeping known values", () => {
const result = stripUnknownConfigKeys({
hooks: {},
unexpected: true,
} as never);
expect(result.removed).toContain("unexpected");
expect((result.config as Record<string, unknown>).unexpected).toBeUndefined();
expect((result.config as Record<string, unknown>).hooks).toEqual({});
});
});
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-04-27)
¤
*© Formatika GbR, Deutschland