import { describe, it, expect } from 'vitest'; import { checkImage } from '../../resources/js/lib/advertising/imageRule'; describe('imageRule — checkImage', () => { it('пропускает 500×500 png весом 1 КБ', () => { const result = checkImage({ width: 500, height: 500, bytes: 1024, mime: 'image/png' }); expect(result).toBeNull(); }); it('отклоняет картинку меньше минимума 450×450', () => { const result = checkImage({ width: 449, height: 500, bytes: 1024, mime: 'image/png' }); expect(result).toMatch(/450/); }); it('отклоняет картинку тяжелее 10 МБ', () => { const result = checkImage({ width: 500, height: 500, bytes: 11 * 1024 * 1024, mime: 'image/png', }); expect(result).toMatch(/10/); }); it('отклоняет недопустимый формат (webp)', () => { const result = checkImage({ width: 500, height: 500, bytes: 1024, mime: 'image/webp' }); expect(result).toMatch(/формат/i); }); });