mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
test: tighten model source plan assertions
This commit is contained in:
@@ -51,11 +51,9 @@ describe("planAllModelListSources", () => {
|
||||
cfg: {},
|
||||
});
|
||||
|
||||
expect(plan).toMatchObject({
|
||||
kind: "manifest",
|
||||
requiresInitialRegistry: false,
|
||||
skipRuntimeModelSuppression: true,
|
||||
});
|
||||
expect(plan.kind).toBe("manifest");
|
||||
expect(plan.requiresInitialRegistry).toBe(false);
|
||||
expect(plan.skipRuntimeModelSuppression).toBe(true);
|
||||
expect(plan.manifestCatalogRows).toEqual([catalogRow]);
|
||||
expect(mocks.loadStaticManifestCatalogRowsForList).toHaveBeenCalledWith({
|
||||
cfg: {},
|
||||
@@ -77,11 +75,9 @@ describe("planAllModelListSources", () => {
|
||||
cfg: {},
|
||||
});
|
||||
|
||||
expect(plan).toMatchObject({
|
||||
kind: "provider-index",
|
||||
requiresInitialRegistry: false,
|
||||
skipRuntimeModelSuppression: true,
|
||||
});
|
||||
expect(plan.kind).toBe("provider-index");
|
||||
expect(plan.requiresInitialRegistry).toBe(false);
|
||||
expect(plan.skipRuntimeModelSuppression).toBe(true);
|
||||
expect(plan.providerIndexCatalogRows).toEqual([providerIndexRow]);
|
||||
expect(mocks.hasProviderStaticCatalogForFilter).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -96,11 +92,9 @@ describe("planAllModelListSources", () => {
|
||||
cfg: {},
|
||||
});
|
||||
|
||||
expect(plan).toMatchObject({
|
||||
kind: "registry",
|
||||
requiresInitialRegistry: true,
|
||||
skipRuntimeModelSuppression: false,
|
||||
});
|
||||
expect(plan.kind).toBe("registry");
|
||||
expect(plan.requiresInitialRegistry).toBe(true);
|
||||
expect(plan.skipRuntimeModelSuppression).toBe(false);
|
||||
expect(plan.manifestCatalogRows).toEqual([catalogRow]);
|
||||
expect(mocks.loadStaticManifestCatalogRowsForList).toHaveBeenCalledWith({
|
||||
cfg: {},
|
||||
@@ -116,18 +110,15 @@ describe("planAllModelListSources", () => {
|
||||
it("allows scoped runtime catalog plans to fall back to registry rows", async () => {
|
||||
const { planAllModelListSources } = await import("./list.source-plan.js");
|
||||
|
||||
await expect(
|
||||
planAllModelListSources({
|
||||
all: true,
|
||||
providerFilter: "openrouter",
|
||||
cfg: {},
|
||||
}),
|
||||
).resolves.toMatchObject({
|
||||
kind: "provider-runtime-scoped",
|
||||
requiresInitialRegistry: false,
|
||||
skipRuntimeModelSuppression: false,
|
||||
fallbackToRegistryWhenEmpty: true,
|
||||
const plan = await planAllModelListSources({
|
||||
all: true,
|
||||
providerFilter: "openrouter",
|
||||
cfg: {},
|
||||
});
|
||||
expect(plan.kind).toBe("provider-runtime-scoped");
|
||||
expect(plan.requiresInitialRegistry).toBe(false);
|
||||
expect(plan.skipRuntimeModelSuppression).toBe(false);
|
||||
expect(plan.fallbackToRegistryWhenEmpty).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps broad all-model lists on the registry path with cheap catalog supplements", async () => {
|
||||
@@ -141,11 +132,9 @@ describe("planAllModelListSources", () => {
|
||||
cfg: {},
|
||||
});
|
||||
|
||||
expect(plan).toMatchObject({
|
||||
kind: "registry",
|
||||
requiresInitialRegistry: true,
|
||||
skipRuntimeModelSuppression: false,
|
||||
});
|
||||
expect(plan.kind).toBe("registry");
|
||||
expect(plan.requiresInitialRegistry).toBe(true);
|
||||
expect(plan.skipRuntimeModelSuppression).toBe(false);
|
||||
expect(plan.manifestCatalogRows).toEqual([catalogRow]);
|
||||
expect(plan.providerIndexCatalogRows).toEqual([providerIndexRow]);
|
||||
expect(mocks.loadSupplementalManifestCatalogRowsForList).toHaveBeenCalledWith({
|
||||
@@ -159,17 +148,14 @@ describe("planAllModelListSources", () => {
|
||||
const { planAllModelListSources } = await import("./list.source-plan.js");
|
||||
mocks.hasProviderStaticCatalogForFilter.mockResolvedValueOnce(true);
|
||||
|
||||
await expect(
|
||||
planAllModelListSources({
|
||||
all: true,
|
||||
providerFilter: "codex",
|
||||
cfg: {},
|
||||
}),
|
||||
).resolves.toMatchObject({
|
||||
kind: "provider-runtime-static",
|
||||
requiresInitialRegistry: false,
|
||||
skipRuntimeModelSuppression: true,
|
||||
fallbackToRegistryWhenEmpty: true,
|
||||
const plan = await planAllModelListSources({
|
||||
all: true,
|
||||
providerFilter: "codex",
|
||||
cfg: {},
|
||||
});
|
||||
expect(plan.kind).toBe("provider-runtime-static");
|
||||
expect(plan.requiresInitialRegistry).toBe(false);
|
||||
expect(plan.skipRuntimeModelSuppression).toBe(true);
|
||||
expect(plan.fallbackToRegistryWhenEmpty).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user