2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-15 11:59:42 +03:00

fix(utils): replace getRandomValues with crypto module (#6788)

This commit is contained in:
Willian Agostini
2025-02-18 09:36:51 -03:00
committed by GitHub
parent 32c7bcc0f2
commit 23a25af068
2 changed files with 25 additions and 2 deletions
+20
View File
@@ -80,4 +80,24 @@ describe('utils', function (){
assert.strictEqual(JSON.stringify(jsonObject), JSON.stringify({x: 1, y:2, obj: {ok: 1}}))
});
});
describe('generateString', function () {
it('should generate a string of the specified length using the default alphabet', function () {
const size = 10;
const str = utils.generateString(size);
assert.strictEqual(str.length, size);
});
it('should generate a string using only characters from the default alphabet', function () {
const size = 10;
const alphabet = utils.ALPHABET.ALPHA_DIGIT;
const str = utils.generateString(size, alphabet);
for (let char of str) {
assert.ok(alphabet.includes(char), `Character ${char} is not in the alphabet`);
}
});
});
});