Files
kochwas/tests/unit/description-phrases.test.ts

27 lines
820 B
TypeScript
Raw Normal View History

import { describe, it, expect } from 'vitest';
import { DESCRIPTION_PHRASES, pickRandomPhrase } from '../../src/lib/server/ai/description-phrases';
describe('description-phrases', () => {
it('contains exactly 50 entries', () => {
expect(DESCRIPTION_PHRASES).toHaveLength(50);
});
it('has no empty or whitespace-only entries', () => {
for (const phrase of DESCRIPTION_PHRASES) {
expect(phrase.trim().length).toBeGreaterThan(0);
}
});
it('has no duplicates', () => {
const set = new Set(DESCRIPTION_PHRASES);
expect(set.size).toBe(DESCRIPTION_PHRASES.length);
});
it('pickRandomPhrase returns a member of the pool', () => {
const pool = new Set(DESCRIPTION_PHRASES);
for (let i = 0; i < 100; i++) {
expect(pool.has(pickRandomPhrase())).toBe(true);
}
});
});