Skip to content

Commit 6f73958

Browse files
committed
CCM-10893 Add unit test
1 parent f908ba3 commit 6f73958

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

frontend/src/__tests__/utils/truncate.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ test('returns full string if under max length', () => {
88
expect(truncate('Hello', 10)).toBe('Hello');
99
});
1010

11+
test('returns original text when exactly max length', () => {
12+
expect(truncate('Hello', 5)).toBe('Hello');
13+
});
14+
1115
test('truncates and adds ellipsis if over max length', () => {
1216
expect(truncate('This is a long string', 10)).toBe('This is a…');
1317
});
1418

15-
it('trims trailing whitespace before ellipsis', () => {
19+
test('trims trailing whitespace before ellipsis', () => {
1620
expect(truncate('Hello world', 6)).toBe('Hello…');
1721
});

0 commit comments

Comments
 (0)