Skip to content

Commit 436436a

Browse files
author
roberttwang
committed
test(settings): cover CodeBuddy connection requests
1 parent d202929 commit 436436a

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎webtest/tests/runner-codebuddy-environment.test.mjs‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ test('CLI model editor keeps machine account and personal API Key catalogs indep
140140
app.router.post('/api/runners/runner-cb/models/probe', {
141141
source:'runner', models:[{id:'codex/account-model',name:'Account model'}],
142142
});
143-
app.router.post('/api/users/1/cli-models/probe', {
143+
app.router.post('/api/users/1/cli-models/probe', ({body}) => body.connectOnly ? {source:'official', connected:true} : {
144144
source:'official', models:[model,{id:'another-model',name:'Another model'}],
145145
});
146146
app.router.put('/api/runners/runner-cb/models', ({body}) => {
@@ -181,8 +181,14 @@ test('CLI model editor keeps machine account and personal API Key catalogs indep
181181
assert.deepEqual(modelIDs(), [model.id]);
182182
picker('probe').click();
183183
await settle();
184-
assert.match(app.document.querySelector('.runner-model-editor').textContent, /来自官方服务/);
184+
assert.match(app.document.querySelector('.runner-model-editor').textContent, /来自 CodeBuddy CLI/);
185185
assert.deepEqual(app.router.calls.find(c => c.path.endsWith('/cli-models/probe')).body, {engine:'codebuddy',apiKey:''});
186+
picker('connection').click();
187+
await settle();
188+
assert.match(app.document.querySelector('.runner-model-editor [data-catalog-probe]').textContent, /连接成功/);
189+
assert.deepEqual(app.router.calls.filter(c => c.path.endsWith('/cli-models/probe')).at(-1).body, {
190+
engine:'codebuddy', apiKey:'', connectOnly:true, model:model.id,
191+
});
186192
app.document.querySelector('#confirmCancelBtn').click();
187193
});
188194

0 commit comments

Comments
 (0)