This commit is contained in:
2025-12-17 01:23:09 +01:00
parent f01e01e50c
commit 4d890863d3
73 changed files with 2632 additions and 3224 deletions

View File

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