-
-
Notifications
You must be signed in to change notification settings - Fork 120
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 #316 from va-stefanek/feature/text-length
feat(size): allow to specify string length of random values
- Loading branch information
Showing
5 changed files
with
50 additions
and
3 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
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,3 @@ | ||
export function isString(value: any): value is string { | ||
return typeof value === 'string'; | ||
} |
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,25 @@ | ||
import { randAccount } from '../lib/account'; | ||
import { randMovie } from '../lib/movie'; | ||
|
||
describe('maxCharCount', () => { | ||
it('should return 20 random movies with name length equal or smaller than 8', () => { | ||
const result = randMovie({ length: 20, maxCharCount: 8 }); | ||
|
||
expect(result).toHaveLength(20); | ||
result.forEach((movie) => expect(movie.length).toBeLessThanOrEqual(8)); | ||
}); | ||
|
||
it('should return 50 random movies with name length equal or smaller than 1', () => { | ||
const result = randMovie({ length: 50, maxCharCount: 1 }); | ||
|
||
expect(result).toHaveLength(50); | ||
result.forEach((movie) => expect(movie.length).toBeLessThanOrEqual(1)); | ||
}); | ||
|
||
it('should return 20 random movies with name length equal or smaller than 20', () => { | ||
const result = randAccount({ length: 20, maxCharCount: 20 }); | ||
|
||
expect(result).toHaveLength(20); | ||
result.forEach((account) => expect(account.length).toBeLessThanOrEqual(20)); | ||
}); | ||
}); |
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