mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 21:21:10 +00:00
fix(ci): restore control-ui and provider policy checks
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { ModelDefinitionConfig } from "../config/types.models.js";
|
||||
import type { ModelDefinitionConfig, ModelProviderConfig } from "../config/types.models.js";
|
||||
import { resolveBundledProviderPolicySurface } from "./provider-public-artifacts.js";
|
||||
|
||||
function createModel(id: string, name: string): ModelDefinitionConfig {
|
||||
@@ -71,9 +71,9 @@ describe("provider public artifacts", () => {
|
||||
const surface = resolveBundledProviderPolicySurface("openai");
|
||||
expect(surface?.normalizeConfig).toBeTypeOf("function");
|
||||
|
||||
const providerConfig = {
|
||||
const providerConfig: ModelProviderConfig = {
|
||||
baseUrl: "https://api.openai.com/v1",
|
||||
api: "openai-completions" as const,
|
||||
api: "openai-completions",
|
||||
models: [createModel("gpt-5", "gpt-5")],
|
||||
};
|
||||
expect(
|
||||
|
||||
19
src/shared/record-coerce.test.ts
Normal file
19
src/shared/record-coerce.test.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { asNullableRecord, asOptionalRecord } from "./record-coerce.js";
|
||||
|
||||
describe("record-coerce", () => {
|
||||
it("keeps record coercion behavior for optional and nullable variants", () => {
|
||||
expect(asOptionalRecord({ ok: true })).toEqual({ ok: true });
|
||||
expect(asOptionalRecord(null)).toBeUndefined();
|
||||
expect(asNullableRecord({ ok: true })).toEqual({ ok: true });
|
||||
expect(asNullableRecord(null)).toBeNull();
|
||||
});
|
||||
|
||||
it("stays isolated from utils.ts so browser bundles stay Node-free", () => {
|
||||
const source = readFileSync(path.resolve("src/shared/record-coerce.ts"), "utf8");
|
||||
|
||||
expect(source).not.toContain("../utils.js");
|
||||
});
|
||||
});
|
||||
@@ -1,4 +1,7 @@
|
||||
import { isRecord } from "../utils.js";
|
||||
// Keep this local so browser bundles do not pull in src/utils.ts and its Node-only side effects.
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return value !== null && typeof value === "object";
|
||||
}
|
||||
|
||||
export function asRecord(value: unknown): Record<string, unknown> {
|
||||
return typeof value === "object" && value !== null ? (value as Record<string, unknown>) : {};
|
||||
|
||||
Reference in New Issue
Block a user