dockerhub-description/__test__/utils.unit.test.ts
Peter Evans 4b1a4bb484
feat: truncate short description exceeding the byte limit (#143)
* feat: truncate short description exceeding the byte limit

* fix tests
2023-04-07 09:16:46 +09:00

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('😀😁')
})
})