feat: truncate content exceeding the byte limit (#129)
Some checks failed
Publish Docker Image / publish (push) Has been cancelled
Some checks failed
Publish Docker Image / publish (push) Has been cancelled
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {completeRelativeUrls} from '../src/readme-helper'
|
||||
import {completeRelativeUrls, truncateToBytes} from '../src/readme-helper'
|
||||
|
||||
describe('complete relative urls tests', () => {
|
||||
const GITHUB_SERVER_URL = process.env['GITHUB_SERVER_URL']
|
||||
@@ -333,3 +333,12 @@ describe('complete relative urls tests', () => {
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
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