mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-20 09:09:35 +02:00
25 lines
1.1 KiB
TypeScript
25 lines
1.1 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|||
|
|
import { STOCK_CLIS } from '../src/config/cli-registry/stock.js';
|
||
|
|
|
||
|
|
const copilot = STOCK_CLIS.find((c) => (c.id as string) === 'copilot')!;
|
||
|
|
|
||
|
|
describe('GitHub Copilot custom endpoint (BYOK)', () => {
|
||
|
|
it('injects its COPILOT_PROVIDER_* variables, with the /v1 suffix an OpenAI route needs', () => {
|
||
|
|
expect(copilot.capabilities.customModelInjection).toEqual({
|
||
|
|
kind: 'env',
|
||
|
|
baseUrlVar: 'COPILOT_PROVIDER_BASE_URL',
|
||
|
|
apiKeyVar: 'COPILOT_PROVIDER_API_KEY',
|
||
|
|
modelVars: ['COPILOT_MODEL'],
|
||
|
|
appendV1Suffix: true,
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
it('keeps every injected variable privileged, so a non-granted owner cannot set them by hand', () => {
|
||
|
|
const injection = copilot.capabilities.customModelInjection;
|
||
|
|
if (injection.kind !== 'env') throw new Error('expected env injection');
|
||
|
|
for (const name of [injection.baseUrlVar, injection.apiKeyVar, ...injection.modelVars]) {
|
||
|
|
expect(copilot.capabilities.privilegedEnvKeys).toContain(name);
|
||
|
|
expect(name.startsWith('COPILOT_')).toBe(true); // reachable through the prefix allowlist
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|