Skip to content

Commit cfc50fb

Browse files
committed
test(gui): route model-discovery stubs through the pinned transport
The same #697 transport change that broke the root catalog tests also breaks four cases in gui/tests/models-empty-provider.test.tsx: they stub `globalThis.fetch`, discovery no longer reads it, and the calls hang on real DNS until the 5s test timeout. Reuse the `withStubbedProviderFetch` helper so these configs carry the caller-owned executor too. Test wiring only. This one hid from the root suite: `bun run test` covers `tests/`, while CI runs `cd gui && bun test tests` as a separate step, so the failure only appeared on the runner.
1 parent 693347d commit cfc50fb

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

gui/tests/models-empty-provider.test.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { LanguageProvider } from "../src/i18n/provider";
88
import Models from "../src/pages/Models";
99
import { EmptyProviderHint } from "../src/pages/models-provider-hints";
1010
import type { ProviderDiscoverySummary } from "../src/models-groups";
11-
import { gatherRoutedModels } from "../../src/codex/catalog";
11+
import { gatherRoutedModels as gatherRoutedModelsDirect } from "../../src/codex/catalog";
12+
import { withStubbedProviderFetch } from "../../tests/helpers/catalog-provider-fetch";
1213
import {
1314
clearModelCache,
1415
getProviderDiscoveryStatus,
@@ -20,6 +21,14 @@ import { handleManagementAPI } from "../../src/server/management-api";
2021
let previousLanguage: unknown;
2122
const originalFetch = globalThis.fetch;
2223

24+
/**
25+
* Discovery runs on the pinned outbound transport, which does not read
26+
* `globalThis.fetch`. These tests stub that global, so every config gets the
27+
* caller-owned executor that hands control back to the stub.
28+
*/
29+
const gatherRoutedModels: typeof gatherRoutedModelsDirect = (config, options) =>
30+
gatherRoutedModelsDirect(withStubbedProviderFetch(config), options);
31+
2332
beforeEach(() => {
2433
previousLanguage = (globalThis.navigator as { language?: unknown } | undefined)?.language;
2534
Object.defineProperty(globalThis.navigator, "language", {

0 commit comments

Comments
 (0)