mirror of
https://github.com/peter-evans/dockerhub-description.git
synced 2024-11-21 11:39:34 +01:00
4b1a4bb484
* feat: truncate short description exceeding the byte limit * fix tests
10 lines
349 B
TypeScript
10 lines
349 B
TypeScript
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('😀😁')
|
|
})
|
|
})
|