a lot
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { createKeyRotator, parseKeys } from '../src/key-store.js';
|
||||
import { createKeyRotator, loadConfiguredKeys, parseKeys, parseKeysJson } from '../src/key-store.js';
|
||||
|
||||
describe('key store', () => {
|
||||
it('parses JSON keys and prefers the environment variable', async () => {
|
||||
expect(parseKeysJson('[" a ","b"]')).toEqual(['a', 'b']);
|
||||
expect(() => parseKeysJson('{"key":"a"}')).toThrow();
|
||||
await expect(loadConfiguredKeys({ env: { OPENCODE_API_KEYS: '["env-key"]' }, path: '/does-not-exist' })).resolves.toEqual(['env-key']);
|
||||
});
|
||||
|
||||
it('parses keys, blank lines, and comments', () => {
|
||||
expect(parseKeys(' first \n\nsecond # note\n# ignored\n')).toEqual(['first', 'second']);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user