test(ai-review): 更新統計四欄、OpenRouter 精確比對與 codeWindow 邊界測試

This commit is contained in:
Jeffery
2026-06-23 13:15:58 +08:00
parent e73e18f2c3
commit 55bd14e480
3 changed files with 18 additions and 11 deletions
+5 -5
View File
@@ -100,11 +100,11 @@ describe('fetchAccountQuota', () => {
}
});
it('accepts a real openrouter subdomain', async () => {
const get = async () => ({ data: { data: { usage: 1, limit: 10, limit_remaining: 9 } } });
const q = await fetchAccountQuota('openai', { apiKeys: ['k'], baseURL: 'https://api.openrouter.ai/api/v1' }, { get });
assert.equal(q.available, true);
assert.equal(q.source, 'openrouter');
it('only accepts the exact openrouter.ai apex host (subdomains are not OpenRouter)', async () => {
const get = async () => { throw new Error('should not be called for non-apex host'); };
const q = await fetchAccountQuota('openai', { apiKeys: ['sk-secret'], baseURL: 'https://api.openrouter.ai/api/v1' }, { get });
assert.equal(q.available, false);
assert.match(q.reason, /API key 無法取得/);
});
it('reports 不適用 for local platforms', async () => {