14 lines
488 B
JavaScript
14 lines
488 B
JavaScript
import { describe, expect, it } from 'vitest';
|
|
import { createKeyRotator, parseKeys } from '../src/key-store.js';
|
|
|
|
describe('key store', () => {
|
|
it('parses keys, blank lines, and comments', () => {
|
|
expect(parseKeys(' first \n\nsecond # note\n# ignored\n')).toEqual(['first', 'second']);
|
|
});
|
|
|
|
it('rotates keys round-robin', () => {
|
|
const rotator = createKeyRotator(['a', 'b']);
|
|
expect([rotator.next(), rotator.next(), rotator.next()]).toEqual(['a', 'b', 'a']);
|
|
});
|
|
});
|