feat(ai): 50er-Pool Magie-Phrasen fuer Foto-description
This commit is contained in:
26
tests/unit/description-phrases.test.ts
Normal file
26
tests/unit/description-phrases.test.ts
Normal 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);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user