openclaw/extensions/gmi/index.test.ts
Peter Steinberger 5fdd2907c4
refactor(test): simplify catalog guards and fix native report fixture (#139496)
* refactor(test): simplify GMI and Novita catalog assertions

* test: keep native report process inspection real
2026-09-05 18:39:55 -07:00

25 lines
1.1 KiB
TypeScript

// Gmi tests cover index plugin behavior.
import { registerSingleProviderPlugin } from "openclaw/plugin-sdk/plugin-test-runtime";
import { describe, expect, it } from "vitest";
import plugin from "./index.js";
describe("gmi provider plugin", () => {
it("registers GMI Cloud as an OpenAI-compatible provider", async () => {
const provider = await registerSingleProviderPlugin(plugin);
expect(provider.id).toBe("gmi");
expect(provider.aliases).toEqual(["gmi-cloud", "gmicloud"]);
expect(provider.envVars).toEqual(["GMI_API_KEY"]);
expect(provider.auth?.map((method) => method.id)).toEqual(["api-key"]);
expect(provider.auth?.[0]?.starterModel).toBe("gmi/openai/gpt-5.6-sol");
const result = await provider.staticCatalog?.run({
config: {},
env: {},
resolveProviderApiKey: () => ({}),
} as never);
const catalogProvider = result && "provider" in result ? result.provider : undefined;
expect(catalogProvider?.baseUrl).toBe("https://api.gmi-serving.com/v1");
expect(catalogProvider?.models?.map((model) => model.id)).toContain("openai/gpt-5.6-sol");
});
});