Skip to content

Commit

Permalink
test: rewrite random (faker-js#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 authored and demipel8 committed Mar 11, 2022
1 parent 8dc2269 commit f2a3655
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 168 deletions.
15 changes: 8 additions & 7 deletions src/random.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class Random {
number(
options?: number | { min?: number; max?: number; precision?: number }
): number {
console.log(
console.warn(
'Deprecation Warning: faker.random.number is now located in faker.datatype.number'
);
return this.faker.datatype.number(options);
Expand Down Expand Up @@ -86,7 +86,7 @@ export class Random {
float(
options?: number | { min?: number; max?: number; precision?: number }
): number {
console.log(
console.warn(
'Deprecation Warning: faker.random.float is now located in faker.datatype.float'
);
return this.faker.datatype.float(options);
Expand Down Expand Up @@ -186,7 +186,7 @@ export class Random {
* @see faker.datatype.uuid()
*/
uuid(): string {
console.log(
console.warn(
'Deprecation Warning: faker.random.uuid is now located in faker.datatype.uuid'
);
return this.faker.datatype.uuid();
Expand All @@ -202,7 +202,7 @@ export class Random {
* @see faker.datatype.boolean()
*/
boolean(): boolean {
console.log(
console.warn(
'Deprecation Warning: faker.random.boolean is now located in faker.datatype.boolean'
);
return this.faker.datatype.boolean();
Expand Down Expand Up @@ -291,7 +291,7 @@ export class Random {
* @deprecated
*/
image(): string {
console.log(
console.warn(
'Deprecation Warning: faker.random.image is now located in faker.image.image'
);
return this.faker.image.image();
Expand All @@ -316,10 +316,11 @@ export class Random {
* @method faker.random.alpha
* @param options // defaults to { count: 1, upcase: false, bannedChars: [] }
*/
// TODO @Shinigami92 2022-02-14: Tests covered `(count, options)`, but they were never typed like that
alpha(
options?:
| number
| { count: number; upcase?: boolean; bannedChars?: string[] }
| { count?: number; upcase?: boolean; bannedChars?: string[] }
): string {
if (typeof options === 'undefined') {
options = {
Expand Down Expand Up @@ -455,7 +456,7 @@ export class Random {
* @deprecated
*/
hexaDecimal(count?: number): string {
console.log(
console.warn(
'Deprecation Warning: faker.random.hexaDecimal is now located in faker.datatype.hexaDecimal'
);
return this.faker.datatype.hexaDecimal(count);
Expand Down
Loading

0 comments on commit f2a3655

Please sign in to comment.