chore(tsgo/format): fix CI errors

This commit is contained in:
Gustavo Madeira Santana
2026-02-21 17:51:56 -05:00
parent 6ac89757ba
commit 0e1aa77928
15 changed files with 133 additions and 59 deletions

View File

@@ -1,5 +1,6 @@
import { describe, expect, it } from "vitest";
import { migrateLegacyConfig, validateConfigObject } from "./config.js";
import type { OpenClawConfig } from "./config.js";
function getLegacyRouting(config: unknown) {
return (config as { routing?: Record<string, unknown> } | undefined)?.routing;
@@ -470,13 +471,16 @@ describe("legacy config detection", () => {
const res = validateConfigObject(testCase.input);
expect(res.ok, testCase.name).toBe(true);
if (res.ok) {
if (testCase.expectedTopLevel !== undefined) {
if ("expectedTopLevel" in testCase && testCase.expectedTopLevel !== undefined) {
expect(res.config.channels?.telegram?.streaming, testCase.name).toBe(
testCase.expectedTopLevel,
);
expect(res.config.channels?.telegram?.streamMode, testCase.name).toBeUndefined();
}
if (testCase.expectedAccountStreaming !== undefined) {
if (
"expectedAccountStreaming" in testCase &&
testCase.expectedAccountStreaming !== undefined
) {
expect(res.config.channels?.telegram?.accounts?.ops?.streaming, testCase.name).toBe(
testCase.expectedAccountStreaming,
);

View File

@@ -409,12 +409,12 @@ describe("redactConfigSnapshot", () => {
}),
assert: ({ redacted, restored }) => {
const cfg = redacted as Record<string, Record<string, unknown>>;
const cfgCustom2 = cfg.custom2 as unknown[];
const cfgCustom2 = cfg.custom2 as unknown as unknown[];
expect(cfgCustom2.length).toBeGreaterThan(0);
expect((cfg.custom1.anykey as Record<string, unknown>).mySecret).toBe(REDACTED_SENTINEL);
expect((cfgCustom2[0] as Record<string, unknown>).mySecret).toBe(REDACTED_SENTINEL);
const out = restored as Record<string, Record<string, unknown>>;
const outCustom2 = out.custom2 as unknown[];
const outCustom2 = out.custom2 as unknown as unknown[];
expect(outCustom2.length).toBeGreaterThan(0);
expect((out.custom1.anykey as Record<string, unknown>).mySecret).toBe(
"this-is-a-custom-secret-value",
@@ -436,12 +436,12 @@ describe("redactConfigSnapshot", () => {
}),
assert: ({ redacted, restored }) => {
const cfg = redacted as Record<string, Record<string, unknown>>;
const cfgCustom2 = cfg.custom2 as unknown[];
const cfgCustom2 = cfg.custom2 as unknown as unknown[];
expect(cfgCustom2.length).toBeGreaterThan(0);
expect((cfg.custom1.anykey as Record<string, unknown>).mySecret).toBe(REDACTED_SENTINEL);
expect((cfgCustom2[0] as Record<string, unknown>).mySecret).toBe(REDACTED_SENTINEL);
const out = restored as Record<string, Record<string, unknown>>;
const outCustom2 = out.custom2 as unknown[];
const outCustom2 = out.custom2 as unknown as unknown[];
expect(outCustom2.length).toBeGreaterThan(0);
expect((out.custom1.anykey as Record<string, unknown>).mySecret).toBe(
"this-is-a-custom-secret-value",