test(config): remove runtime legacy compat wrapper · openclaw/openclaw@4eedc47
steipete
·
2026-05-02
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { afterEach, describe, expect, it, vi } from "vitest"; |
2 | 2 | import { __testing, resolveCliChannelOptions } from "./channel-options.js"; |
| 3 | +import { __testing as startupMetadataTesting } from "./startup-metadata.js"; |
3 | 4 | |
4 | 5 | const readFileSyncMock = vi.hoisted(() => vi.fn()); |
5 | 6 | |
@@ -23,6 +24,7 @@ vi.mock("../channels/ids.js", () => ({
|
23 | 24 | describe("resolveCliChannelOptions", () => { |
24 | 25 | afterEach(() => { |
25 | 26 | __testing.resetPrecomputedChannelOptionsForTests(); |
| 27 | +startupMetadataTesting.clearStartupMetadataCache(); |
26 | 28 | vi.clearAllMocks(); |
27 | 29 | }); |
28 | 30 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { describe, expect, it } from "vitest"; |
2 | | -import { applyRuntimeLegacyConfigMigrations } from "../commands/doctor/shared/runtime-compat-api.js"; |
3 | 2 | import { |
4 | 3 | getConfigValueAtPath, |
5 | 4 | parseConfigPath, |
@@ -940,7 +939,7 @@ describe("config strict validation", () => {
|
940 | 939 | }); |
941 | 940 | }); |
942 | 941 | |
943 | | -it("accepts legacy messages.tts provider keys via auto-migration and reports legacyIssues", async () => { |
| 942 | +it("reports legacy messages.tts provider keys without read-time auto-migration", async () => { |
944 | 943 | const raw = { |
945 | 944 | messages: { |
946 | 945 | tts: { |
@@ -953,29 +952,13 @@ describe("config strict validation", () => {
|
953 | 952 | }, |
954 | 953 | }; |
955 | 954 | const issues = findLegacyConfigIssues(raw); |
956 | | -const migrated = applyRuntimeLegacyConfigMigrations(raw); |
957 | 955 | |
958 | 956 | expect(issues.some((issue) => issue.path === "messages.tts")).toBe(true); |
959 | | -expect(migrated.next).not.toBeNull(); |
960 | | - |
961 | | -const next = migrated.next as { |
962 | | -messages?: { |
963 | | -tts?: { |
964 | | -providers?: { |
965 | | -elevenlabs?: { |
966 | | -apiKey?: string; |
967 | | -voiceId?: string; |
968 | | -}; |
969 | | -}; |
970 | | -elevenlabs?: unknown; |
971 | | -}; |
972 | | -}; |
973 | | -} | null; |
974 | | -expect(next?.messages?.tts?.providers?.elevenlabs).toEqual({ |
| 957 | +expect(raw.messages.tts.elevenlabs).toEqual({ |
975 | 958 | apiKey: "test-key", |
976 | 959 | voiceId: "voice-1", |
977 | 960 | }); |
978 | | -expect(next?.messages?.tts?.elevenlabs).toBeUndefined(); |
| 961 | +expect(raw.messages.tts).not.toHaveProperty("providers"); |
979 | 962 | }); |
980 | 963 | |
981 | 964 | it("rejects legacy sandbox perSession without read-time auto-migration", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2,7 +2,7 @@ import fs from "node:fs/promises";
|
2 | 2 | import os from "node:os"; |
3 | 3 | import path from "node:path"; |
4 | 4 | import { describe, expect, it, vi } from "vitest"; |
5 | | -import { applyRuntimeLegacyConfigMigrations } from "../commands/doctor/shared/runtime-compat-api.js"; |
| 5 | +import { normalizeCompatibilityConfigValues } from "../commands/doctor-legacy-config.js"; |
6 | 6 | import { createConfigIO } from "./io.js"; |
7 | 7 | import { normalizeExecSafeBinProfilesInConfig } from "./normalize-exec-safe-bin.js"; |
8 | 8 | import type { OpenClawConfig } from "./types.openclaw.js"; |
@@ -155,7 +155,7 @@ describe("config io paths", () => {
|
155 | 155 | }); |
156 | 156 | |
157 | 157 | it("moves WhatsApp shared access defaults into accounts.default during runtime compat", () => { |
158 | | -const migrated = applyRuntimeLegacyConfigMigrations({ |
| 158 | +const migrated = normalizeCompatibilityConfigValues({ |
159 | 159 | channels: { |
160 | 160 | whatsapp: { |
161 | 161 | enabled: true, |
@@ -171,9 +171,8 @@ describe("config io paths", () => {
|
171 | 171 | }, |
172 | 172 | }, |
173 | 173 | }, |
174 | | -}); |
175 | | -const next = migrated.next as OpenClawConfig | null; |
176 | | -expect(next?.channels?.whatsapp?.accounts?.default).toMatchObject({ |
| 174 | +} as OpenClawConfig); |
| 175 | +expect(migrated.config.channels?.whatsapp?.accounts?.default).toMatchObject({ |
177 | 176 | dmPolicy: "allowlist", |
178 | 177 | allowFrom: ["+15550001111"], |
179 | 178 | groupPolicy: "open", |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。