-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
azure, utils: Improve and dedupe
randomUtils
(#1763)
- Loading branch information
1 parent
bbd9dbf
commit a49dd97
Showing
4 changed files
with
29 additions
and
15 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import assert = require('assert'); | ||
import { randomUtils } from '../src/utils/randomUtils'; | ||
|
||
|
||
suite('randomUtils', function (this: Mocha.Suite): void { | ||
test('getRandomHexString', async () => { | ||
// An even number length | ||
assert.strictEqual(randomUtils.getRandomHexString(6).length, 6); | ||
|
||
// An odd number length | ||
assert.strictEqual(randomUtils.getRandomHexString(5).length, 5); | ||
|
||
// Zero length should throw | ||
assert.throws(() => randomUtils.getRandomHexString(0)); | ||
}); | ||
}); |