import { describe, it, expect } from 'vitest'; import { ImageUrl } from './ImageUrl'; describe('ImageUrl', () => { it('should create valid url', () => { const url = ImageUrl.create('https://example.com/image.jpg'); expect(url.toString()).toBe('https://example.com/image.jpg'); }); it('should throw on empty', () => { expect(() => ImageUrl.create('')).toThrow('Image URL cannot be empty'); }); it('should throw on invalid url', () => { expect(() => ImageUrl.create('not-a-url')).toThrow('Invalid image URL format'); }); it('should trim', () => { const url = ImageUrl.create(' https://example.com '); expect(url.toString()).toBe('https://example.com'); }); it('should equal same', () => { const u1 = ImageUrl.create('https://example.com'); const u2 = ImageUrl.create('https://example.com'); expect(u1.equals(u2)).toBe(true); }); it('should not equal different', () => { const u1 = ImageUrl.create('https://example.com/1'); const u2 = ImageUrl.create('https://example.com/2'); expect(u1.equals(u2)).toBe(false); }); });