test(ai-review): 更新統計四欄、OpenRouter 精確比對與 codeWindow 邊界測試
This commit is contained in:
+5
-5
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user