feat(ai): 50er-Pool Magie-Phrasen fuer Foto-description

This commit is contained in:
hsiegeln
2026-04-21 10:38:32 +02:00
parent 9e3d6e8d01
commit c284f4b85b
2 changed files with 82 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
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);
}
});
});