Skip to content

Commit

Permalink
test: add unit tests for "truncateMessage"
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed Mar 30, 2024
1 parent f2c8f04 commit 77f4ad2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/core/ws/utils/truncateMessage.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { truncateMessage } from './truncateMessage'

it('returns a short string as-is', () => {
expect(truncateMessage('')).toBe('')
expect(truncateMessage('hello')).toBe('hello')
})

it('truncates a long string', () => {
expect(truncateMessage('this is a very long string')).toBe(
'this is a very long stri…',
)
})

0 comments on commit 77f4ad2

Please sign in to comment.