test: move lightweight command tests to light suite

This commit is contained in:
Peter Steinberger
2026-05-27 05:13:03 +01:00
parent 2cc6871553
commit 2831d697ce
2 changed files with 79 additions and 0 deletions

View File

@@ -19,6 +19,46 @@ const OPENAI_CODEX_53_MODEL = {
};
const mocks = vi.hoisted(() => {
const emptyPluginIndex = {
version: 1,
hostContractVersion: "test",
compatRegistryVersion: "test",
migrationVersion: 1,
policyHash: "models-list-command-forward-compat-test",
generatedAtMs: 0,
installRecords: {},
plugins: [],
diagnostics: [],
};
const emptyPluginMetadataSnapshot = {
policyHash: "models-list-command-forward-compat-test",
configFingerprint: "models-list-command-forward-compat-test",
index: emptyPluginIndex,
registryDiagnostics: [],
manifestRegistry: { plugins: [], diagnostics: [] },
plugins: [],
diagnostics: [],
byPluginId: new Map(),
normalizePluginId: (pluginId: string) => pluginId,
owners: {
channels: new Map(),
channelConfigs: new Map(),
providers: new Map(),
modelCatalogProviders: new Map(),
cliBackends: new Map(),
setupProviders: new Map(),
commandAliases: new Map(),
contracts: new Map(),
},
metrics: {
registrySnapshotMs: 0,
manifestRegistryMs: 0,
ownerMapsMs: 0,
totalMs: 0,
indexPluginCount: 0,
manifestPluginCount: 0,
},
};
const sourceConfig = {
agents: { defaults: { model: { primary: "openai-codex/gpt-5.4" } } },
models: {
@@ -40,6 +80,7 @@ const mocks = vi.hoisted(() => {
},
};
return {
emptyPluginMetadataSnapshot,
sourceConfig,
resolvedConfig,
loadModelsConfigWithSource: vi.fn(),
@@ -57,6 +98,7 @@ const mocks = vi.hoisted(() => {
printModelTable: vi.fn(),
resolveModelWithRegistry: vi.fn(),
readPersistedInstalledPluginIndexSync: vi.fn(),
loadManifestMetadataSnapshot: vi.fn(),
loadPluginRegistrySnapshotWithMetadata: vi.fn(),
};
});
@@ -96,6 +138,7 @@ function resetMocks() {
mocks.printModelTable.mockReset();
mocks.resolveModelWithRegistry.mockReturnValue({ ...OPENAI_CODEX_MODEL });
mocks.readPersistedInstalledPluginIndexSync.mockReturnValue(null);
mocks.loadManifestMetadataSnapshot.mockReturnValue(mocks.emptyPluginMetadataSnapshot);
mocks.loadPluginRegistrySnapshotWithMetadata.mockReturnValue({
source: "persisted",
snapshot: { plugins: [] },
@@ -271,6 +314,10 @@ function installModelsListCommandForwardCompatMocks() {
readPersistedInstalledPluginIndexSync: mocks.readPersistedInstalledPluginIndexSync,
}));
vi.doMock("../../plugins/manifest-contract-eligibility.js", () => ({
loadManifestMetadataSnapshot: mocks.loadManifestMetadataSnapshot,
}));
vi.doMock("../../plugins/plugin-registry.js", async (importOriginal) => {
const actual = await importOriginal<typeof import("../../plugins/plugin-registry.js")>();
return {

View File

@@ -11,10 +11,42 @@ const commandsLightEntries = [
source: "src/commands/doctor-gateway-auth-token.ts",
test: "src/commands/doctor-gateway-auth-token.test.ts",
},
{
source: "src/commands/doctor/shared/channel-plugin-blockers.ts",
test: "src/commands/doctor/shared/channel-plugin-blockers.test.ts",
},
{
source: "src/commands/doctor/shared/missing-configured-plugin-install.ts",
test: "src/commands/doctor/shared/missing-configured-plugin-install.test.ts",
},
{
source: "src/commands/doctor/shared/preview-warnings.ts",
test: "src/commands/doctor/shared/preview-warnings.test.ts",
},
{
source: "src/commands/doctor/shared/release-configured-plugin-installs.ts",
test: "src/commands/doctor/shared/release-configured-plugin-installs.test.ts",
},
{
source: "src/commands/doctor/shared/stale-plugin-config.ts",
test: "src/commands/doctor/shared/stale-plugin-config.test.ts",
},
{
source: "src/commands/doctor/shared/stale-oauth-profile-shadows.ts",
test: "src/commands/doctor/shared/stale-oauth-profile-shadows.test.ts",
},
{
source: "src/commands/gateway-status/helpers.ts",
test: "src/commands/gateway-status/helpers.test.ts",
},
{
source: "src/commands/models/auth.ts",
test: "src/commands/models/auth.test.ts",
},
{
source: "src/commands/models/list.status-command.ts",
test: "src/commands/models/list.status.test.ts",
},
{
source: "src/commands/sandbox-formatters.ts",
test: "src/commands/sandbox-formatters.test.ts",