feat: truncate short description exceeding the byte limit (#143)
Some checks failed
Publish Docker Image / publish (push) Has been cancelled
Some checks failed
Publish Docker Image / publish (push) Has been cancelled
* feat: truncate short description exceeding the byte limit * fix tests
This commit is contained in:
10
__test__/utils.unit.test.ts
Normal file
10
__test__/utils.unit.test.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import {truncateToBytes} from '../src/utils'
|
||||
|
||||
describe('truncate to bytes tests', () => {
|
||||
test('unicode aware truncation to a number of bytes', async () => {
|
||||
expect(truncateToBytes('test string to be truncated', 10)).toEqual(
|
||||
'test strin'
|
||||
)
|
||||
expect(truncateToBytes('😀😁😂🤣😃😄😅', 10)).toEqual('😀😁')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user