From aee3f6831ac006ef9601d0f4104bb8fabe6b303e Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sat, 22 Oct 2022 11:33:32 +0200 Subject: [PATCH] chore: update to account for the latest changes --- src/modules/helpers/index.ts | 4 ++-- test/helpers.spec.ts | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts index c5a8e8aae4e..85f90931c72 100644 --- a/src/modules/helpers/index.ts +++ b/src/modules/helpers/index.ts @@ -493,7 +493,7 @@ export class HelpersModule { * It is also possible to use multiple parameters (comma separated). * * ```js - * const message = faker.helpers.fake('Your pin is {{random.numeric(4, {allowLeadingZeros: true})}}.') + * const message = faker.helpers.fake('Your pin is {{string.numeric(4, {allowLeadingZeros: true})}}.') * ``` * * It is also NOT possible to use any non-faker methods or plain javascript in such templates. @@ -509,7 +509,7 @@ export class HelpersModule { * faker.helpers.fake('Good Morning {{person.firstName}}!') // 'Good Morning Estelle!' * faker.helpers.fake('You can call me at {{phone.number(!## ### #####!)}}.') // 'You can call me at 202 555 973722.' * faker.helpers.fake('I flipped the coin and got: {{helpers.arrayElement(["heads", "tails"])}}') // 'I flipped the coin and got: tails' - * faker.helpers.fake('I rolled the dice and got: {{random.numeric(1, {"allowLeadingZeros": true})}}') // 'I rolled the dice and got: 6' + * faker.helpers.fake('I rolled the dice and got: {{string.numeric(1, {"allowLeadingZeros": true})}}') // 'I rolled the dice and got: 6' * * @since 7.4.0 */ diff --git a/test/helpers.spec.ts b/test/helpers.spec.ts index 8fdbd5ed928..39aa1982ee5 100644 --- a/test/helpers.spec.ts +++ b/test/helpers.spec.ts @@ -489,19 +489,19 @@ describe('helpers', () => { describe('fake()', () => { it('replaces a token with a random value for a method without parentheses', () => { - const actual = faker.helpers.fake('{{random.numeric}}'); + const actual = faker.helpers.fake('{{string.numeric}}'); expect(actual).toMatch(/^\d$/); }); it('replaces multiple tokens with random values for methods without parentheses', () => { const actual = faker.helpers.fake( - '{{random.numeric}}{{random.numeric}}{{random.numeric}}' + '{{string.numeric}}{{string.numeric}}{{string.numeric}}' ); expect(actual).toMatch(/^\d{3}$/); }); it('replaces a token with a random value for a method with empty parentheses', () => { - const actual = faker.helpers.fake('{{random.numeric()}}'); + const actual = faker.helpers.fake('{{string.numeric()}}'); expect(actual).toMatch(/^\d$/); }); @@ -511,7 +511,7 @@ describe('helpers', () => { }); it('replaces a token with a random value for a method with a simple parameter', () => { - const actual = faker.helpers.fake('{{random.numeric(3)}}'); + const actual = faker.helpers.fake('{{string.numeric(3)}}'); expect(actual).toMatch(/^\d{3}$/); }); @@ -530,7 +530,7 @@ describe('helpers', () => { it('replaces a token with a random value for a method with multiple parameters', () => { const actual = faker.helpers.fake( - '{{random.numeric(5, {"allowLeadingZeros": true})}}' + '{{string.numeric(5, {"allowLeadingZeros": true})}}' ); expect(actual).toMatch(/^\d{5}$/); });