test(ci): align external-agent and workflow endpoint fixtures
This commit is contained in:
1 parent
ece35a1a38
commit
aef56a3108
3 files changed
+11
-27
No files matched your search
@@ -20,7 +20,7 @@ import LocalSubprocessRuntime from '@deepseek-ai/dsh-subprocess-local'
|
||||
import * as claudeCode from '../src/index.ts'
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
const OFFICIAL_DEEPSEEK_BASE_URL = 'https://api.deepseek.com'
|
||||
const OFFICIAL_DEEPSEEK_MESSAGES_BASE_URL = 'https://api.deepseek.com/anthropic'
|
||||
const DEEPSEEK_MODEL = 'deepseek-v4-flash'
|
||||
const sdkRoot = dirname(fileURLToPath(
|
||||
import.meta.resolve('@anthropic-ai/claude-agent-sdk'),
|
||||
@@ -48,15 +48,6 @@ afterEach(async () => {
|
||||
for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
function deepSeekBaseUrl(): string {
|
||||
const configured = (process.env.DEEPSEEK_BASE_URL ?? OFFICIAL_DEEPSEEK_BASE_URL)
|
||||
.replace(/\/+$/, '')
|
||||
if (configured !== OFFICIAL_DEEPSEEK_BASE_URL) {
|
||||
throw new Error('Claude Code DeepSeek e2e requires the official DeepSeek base URL')
|
||||
}
|
||||
return configured
|
||||
}
|
||||
|
||||
async function expectQuiescent(handles: readonly SubprocessHandle[]): Promise<void> {
|
||||
expect(handles.length).toBeGreaterThan(0)
|
||||
for (const handle of handles) {
|
||||
@@ -90,7 +81,7 @@ describe.skipIf(!process.env.DEEPSEEK_API_KEY)(
|
||||
|
||||
const env = {
|
||||
ANTHROPIC_AUTH_TOKEN: apiKey,
|
||||
ANTHROPIC_BASE_URL: `${deepSeekBaseUrl()}/anthropic`,
|
||||
ANTHROPIC_BASE_URL: OFFICIAL_DEEPSEEK_MESSAGES_BASE_URL,
|
||||
ANTHROPIC_MODEL: DEEPSEEK_MODEL,
|
||||
ANTHROPIC_DEFAULT_OPUS_MODEL: DEEPSEEK_MODEL,
|
||||
ANTHROPIC_DEFAULT_SONNET_MODEL: DEEPSEEK_MODEL,
|
||||
|
||||
@@ -53,20 +53,11 @@ function taskText(body: Record<string, unknown>): string {
|
||||
return typeof body.instructions === 'string' ? body.instructions : ''
|
||||
}
|
||||
|
||||
function deepSeekBaseUrl(): string {
|
||||
const configured = (process.env.DEEPSEEK_BASE_URL ?? OFFICIAL_DEEPSEEK_BASE_URL)
|
||||
.replace(/\/+$/, '')
|
||||
if (configured !== OFFICIAL_DEEPSEEK_BASE_URL) {
|
||||
throw new Error('Codex DeepSeek e2e requires the official DeepSeek base URL')
|
||||
}
|
||||
return configured
|
||||
}
|
||||
|
||||
async function completeWithDeepSeek(
|
||||
authorization: string,
|
||||
task: string,
|
||||
): Promise<string> {
|
||||
const response = await fetch(`${deepSeekBaseUrl()}/chat/completions`, {
|
||||
const response = await fetch(`${OFFICIAL_DEEPSEEK_BASE_URL}/chat/completions`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
authorization,
|
||||
|
||||
@@ -828,12 +828,14 @@ describe('Python release workflows', () => {
|
||||
expect(String(realApiPreflightPosix.if)).toContain('head.repo.fork')
|
||||
expect(String(realApiPreflightPosix.if)).toContain('dependabot[bot]')
|
||||
expect(realApiPreflightWindows).toMatchObject({ shell: 'pwsh' })
|
||||
expect(installedRealApiPosix).toMatchObject({
|
||||
env: {
|
||||
DEEPSEEK_API_KEY: '${{ secrets.DEEPSEEK_API_KEY_EXTERNAL }}',
|
||||
DEEPSEEK_BASE_URL: 'https://api.deepseek.com',
|
||||
},
|
||||
})
|
||||
for (const step of [installedRealApiPosix, installedRealApiWindows]) {
|
||||
expect(step).toMatchObject({
|
||||
env: {
|
||||
DEEPSEEK_API_KEY: '${{ secrets.DEEPSEEK_API_KEY_EXTERNAL }}',
|
||||
DEEPSEEK_BASE_URL: 'https://api.deepseek.com/anthropic',
|
||||
},
|
||||
})
|
||||
}
|
||||
expect(JSON.stringify(installedRealApiPosix)).toContain('--scenario sdk-live')
|
||||
expect(JSON.stringify(installedRealApiPosix)).toContain('-u DSH_RUNTIME_MODE')
|
||||
expect(installedRealApiWindows).toMatchObject({ shell: 'pwsh' })
|
||||
|
||||
Reference in new issue
Block a user