-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from almasen/dev
2.2.1
- Loading branch information
Showing
32 changed files
with
4,078 additions
and
7,786 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"tabWidth": 4, | ||
"tabWidth": 2, | ||
"trailingComma": "all", | ||
"singleQuote": true | ||
} |
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
Large diffs are not rendered by default.
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 |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import { generateSecureToken } from '../generateSecureToken'; | ||
|
||
test('token generation algorithm returns a string by default', () => { | ||
for (let length = 1; length <= 32; length++) { | ||
const token: string = generateSecureToken(length); | ||
expect(typeof token).toStrictEqual('string'); | ||
} | ||
for (let length = 1; length <= 32; length++) { | ||
const token: string = generateSecureToken(length); | ||
expect(typeof token).toStrictEqual('string'); | ||
} | ||
}); | ||
|
||
test('token generation algorithm returns a token of input length by default', () => { | ||
for (let length = 1; length <= 32; length++) { | ||
for (let i = 0; i < 100; i++) { | ||
const token = generateSecureToken(length); | ||
expect(token.length).toStrictEqual(length); | ||
} | ||
for (let length = 1; length <= 32; length++) { | ||
for (let i = 0; i < 100; i++) { | ||
const token = generateSecureToken(length); | ||
expect(token.length).toStrictEqual(length); | ||
} | ||
} | ||
}); | ||
|
||
test('token generation algorithm always returns a token consisting of digits only', () => { | ||
for (let length = 1; length <= 64; length++) { | ||
const token = generateSecureToken(length); | ||
expect(/^\d+$/.test(token)).toStrictEqual(true); | ||
} | ||
for (let length = 1; length <= 64; length++) { | ||
const token = generateSecureToken(length); | ||
expect(/^\d+$/.test(token)).toStrictEqual(true); | ||
} | ||
}); |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { generateSecureToken } from '../generateSecureToken'; | ||
|
||
test('token generation algorithm always returns secure random token of digits of expected length', () => { | ||
for (let length = 1; length <= 1000; length++) { | ||
for (let i = 0; i < 50; i++) { | ||
const token = generateSecureToken(length); | ||
expect(token.length).toStrictEqual(length); | ||
expect(/^\d+$/.test(token)).toStrictEqual(true); | ||
} | ||
for (let length = 1; length <= 1000; length++) { | ||
for (let i = 0; i < 50; i++) { | ||
const token = generateSecureToken(length); | ||
expect(token.length).toStrictEqual(length); | ||
expect(/^\d+$/.test(token)).toStrictEqual(true); | ||
} | ||
} | ||
}); |
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { generateSecureToken } from '../generateSecureToken'; | ||
|
||
test('simple token generation works', () => { | ||
const token = generateSecureToken(6); | ||
expect(token.length).toStrictEqual(6); | ||
expect(typeof token).toStrictEqual('string'); | ||
const token = generateSecureToken(6); | ||
expect(token.length).toStrictEqual(6); | ||
expect(typeof token).toStrictEqual('string'); | ||
}); | ||
|
||
test('simple token generation shorthand works', () => { | ||
const token = generateSecureToken(6); | ||
expect(token.length).toStrictEqual(6); | ||
expect(typeof token).toStrictEqual('string'); | ||
const token = generateSecureToken(6); | ||
expect(token.length).toStrictEqual(6); | ||
expect(typeof token).toStrictEqual('string'); | ||
}); |
Oops, something went wrong.