// tests/presets/builtIn.test.ts
import { describe, expect, it } from 'vitest';
import { BUILT_IN_PRESETS, DEFAULT_PRESET } from '~/presets/builtIn';
import { PresetSchema } from '~/presets/schema';
describe('BUILT_IN_PRESETS', () => {
it('ships the 7 curated presets', () => {
expect(BUILT_IN_PRESETS).toHaveLength(7);
});
it('at least one preset uses the kaleidoscope mode', () => {
const k = BUILT_IN_PRESETS.filter((p) => p.params.kaleidoscope > 0);
expect(k.length).toBeGreaterThan(0);
});
it('at least one preset uses the head highlight', () => {
const h = BUILT_IN_PRESETS.filter((p) => p.params.headIntensity > 0);
expect(h.length).toBeGreaterThan(0);
});
it('at least one preset uses the paint blend mode', () => {
const paint = BUILT_IN_PRESETS.filter((p) => p.params.blendMode === 'paint');
expect(paint.length).toBeGreaterThan(0);
});
it('every built-in passes the preset schema', () => {
for (const preset of BUILT_IN_PRESETS) {
const result = PresetSchema.safeParse(preset);
if (!result.success) throw new Error(`${preset.id}: ${result.error.message}`);
expect(result.success).toBe(true);
}
});
it('every preset id is unique', () => {
const ids = BUILT_IN_PRESETS.map((p) => p.id);
expect(new Set(ids).size).toBe(ids.length);
});
it('DEFAULT_PRESET is one of the built-ins', () => {
expect(BUILT_IN_PRESETS).toContain(DEFAULT_PRESET);
});
});