increased code coverage of utils.js file (#6386)

Co-authored-by: Sebastian Beltran <bjohansebas@gmail.com>
This commit is contained in:
Ashish Sharma 2025-04-11 07:27:43 +05:30 committed by GitHub
parent 3dc96995df
commit 5da5a11a49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,6 +25,18 @@ describe('utils.etag(body, encoding)', function(){
})
})
describe('utils.normalizeType acceptParams method', () => {
it('should handle a type with a malformed parameter and break the loop in acceptParams', () => {
const result = utils.normalizeType('text/plain;invalid');
assert.deepEqual(result,{
value: 'text/plain',
quality: 1,
params: {} // No parameters are added since "invalid" has no "="
});
});
});
describe('utils.setCharset(type, charset)', function () {
it('should do anything without type', function () {
assert.strictEqual(utils.setCharset(), undefined);