Skip to content
Source
Sign inSign up
TanStack/schemas

Keep the Xiaomi models poll going when a docs page 404s #656

Mergedtombeckenhammerged 1 commit intomain fromrefs/pull/656/headmerged by tombeckenham View on GitHub

Showing 2 changed files with 60 additions and 2 deletions (loading 1).

x
0 of 2 viewed, 2 left
60 additions and 2 deletionssrc/server/providers/adapters/xiaomi.test.tsModified
View file
@@ -27,7 +27,7 @@
extractedAt: '2026-10-09T00:00:00Z',
afterEach(() => vi.unstubAllGlobals())
-function mockDocs(failedUrl?: string, modelDocument = catalog) {
+function mockDocs(failedUrl?: string, modelDocument = catalog, status = 503) {
const requested: Array<string> = []
vi.stubGlobal('fetch', (input: string | URL | Request) => {
const url = requestUrl(input)
@@ -36,7 +36,10 @@
throw new Error(`unexpected source ${url}`)
return Promise.resolve(
url === failedUrl
- ? new Response('unavailable', { status: 503 })
+ ? new Response('unavailable', {
+ status,
+ ...(status === 404 ? { statusText: 'Not Found' } : {}),
+ })
: new Response(
url === XIAOMI_MODELS
? modelDocument
@@ -126,8 +129,63 @@
listed.models.find((model) => model.rawId === 'mimo-v2.5-pro')