|
1 | 1 | import { afterEach, beforeEach, describe, expect, test } from "bun:test"; |
2 | 2 | import { existsSync, mkdirSync, rmSync } from "node:fs"; |
3 | 3 | import { join } from "node:path"; |
| 4 | +import { nativeModelRows } from "../src/codex/catalog"; |
4 | 5 | import { loadConfig, saveConfig } from "../src/config"; |
5 | 6 | import { handleManagementAPI } from "../src/server/management-api"; |
6 | 7 | import { installIsolatedCodexHome, type IsolatedCodexHome } from "./helpers/isolated-codex-home"; |
@@ -92,6 +93,30 @@ describe("atomic model visibility management", () => { |
92 | 93 | expect(refreshes).toBe(2); |
93 | 94 | }); |
94 | 95 |
|
| 96 | + test("all-on clears stale native ids while preserving combo selectors", async () => { |
| 97 | + const config = loadConfig(); |
| 98 | + const targets = nativeModelRows(config).map(row => ({ id: row.slug, native: true })); |
| 99 | + expect(targets.length).toBeGreaterThan(0); |
| 100 | + config.disabledModels = [ |
| 101 | + targets[0]!.id, |
| 102 | + "stale-native-model", |
| 103 | + "fast-chat", |
| 104 | + "combo/free", |
| 105 | + "google-antigravity/keep", |
| 106 | + "other/keep", |
| 107 | + ]; |
| 108 | + saveConfig(config); |
| 109 | + |
| 110 | + expect((await put({ scope: "provider", provider: "openai", targets, enabled: true })).status).toBe(200); |
| 111 | + expect(loadConfig().disabledModels).toEqual([ |
| 112 | + "fast-chat", |
| 113 | + "combo/free", |
| 114 | + "google-antigravity/keep", |
| 115 | + "other/keep", |
| 116 | + ]); |
| 117 | + expect(refreshes).toBe(1); |
| 118 | + }); |
| 119 | + |
95 | 120 | test("treats a physical combo provider with no configured combos as a routed provider", async () => { |
96 | 121 | saveConfig({ |
97 | 122 | port: 0, |
|
0 commit comments