19 lines
689 B
TypeScript
19 lines
689 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { CommentContent } from './comment-content.vo.js';
|
|
|
|
describe('CommentContent', () => {
|
|
it('trims the value', () => {
|
|
expect(CommentContent.create(' hello ').value).toBe('hello');
|
|
});
|
|
|
|
it('rejects empty content', () => {
|
|
expect(() => CommentContent.create(' ')).toThrow('Комментарий не может быть пустым');
|
|
});
|
|
|
|
it('rejects content longer than the limit', () => {
|
|
expect(() => CommentContent.create('a'.repeat(CommentContent.MAX_LENGTH + 1))).toThrow(
|
|
`Комментарий не может превышать ${CommentContent.MAX_LENGTH} символов`,
|
|
);
|
|
});
|
|
});
|