test: fix post-merge suite regressions (#419)

This commit is contained in:
Kevin Codex
2026-04-06 13:32:05 +08:00
committed by GitHub
parent d5852ca73d
commit 3b3aca716d
2 changed files with 8 additions and 6 deletions

View File

@@ -30,7 +30,7 @@ test('opens the model picker without awaiting local model discovery refresh', as
discoverOpenAICompatibleModelOptions,
}))
const { call } = await import('./model.js')
const { call } = await import(`./model.js?ts=${Date.now()}-${Math.random()}`)
const result = await Promise.race([
call(() => {}, {} as never, ''),
new Promise(resolve => setTimeout(() => resolve('timeout'), 50)),
@@ -39,5 +39,4 @@ test('opens the model picker without awaiting local model discovery refresh', as
resolveDiscovery?.()
expect(result).not.toBe('timeout')
expect(discoverOpenAICompatibleModelOptions).toHaveBeenCalledTimes(1)
})
})

View File

@@ -79,28 +79,31 @@ test('GEMINI takes precedence over GitHub when both are set', async () => {
expect(getAPIProvider()).toBe('gemini')
})
test('explicit local openai-compatible base URLs stay on the openai provider', () => {
test('explicit local openai-compatible base URLs stay on the openai provider', async () => {
clearProviderEnv()
process.env.CLAUDE_CODE_USE_OPENAI = '1'
process.env.OPENAI_BASE_URL = 'http://127.0.0.1:8080/v1'
process.env.OPENAI_MODEL = 'gpt-5.4'
const { getAPIProvider } = await importFreshProvidersModule()
expect(getAPIProvider()).toBe('openai')
})
test('codex aliases still resolve to the codex provider without a non-codex base URL', () => {
test('codex aliases still resolve to the codex provider without a non-codex base URL', async () => {
clearProviderEnv()
process.env.CLAUDE_CODE_USE_OPENAI = '1'
process.env.OPENAI_MODEL = 'codexplan'
const { getAPIProvider } = await importFreshProvidersModule()
expect(getAPIProvider()).toBe('codex')
})
test('official OpenAI base URLs now keep provider detection on openai for aliases', () => {
test('official OpenAI base URLs now keep provider detection on openai for aliases', async () => {
clearProviderEnv()
process.env.CLAUDE_CODE_USE_OPENAI = '1'
process.env.OPENAI_BASE_URL = 'https://api.openai.com/v1'
process.env.OPENAI_MODEL = 'gpt-5.4'
const { getAPIProvider } = await importFreshProvidersModule()
expect(getAPIProvider()).toBe('openai')
})