Skip to content

Commit

Permalink
test: fix random alpha and alphaNumeric tests assumptions (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT authored Apr 4, 2022
1 parent 845c6db commit 8f40d2b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/random.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@ describe('random', () => {
it('should return lowercase letter when no upcase option provided', () => {
const actual = faker.random.alpha();

expect(actual).match(/[a-z]/);
expect(actual).match(/^[a-z]$/);
});

it('should return uppercase when upcase option is true', () => {
const actual = faker.random.alpha({ upcase: true });
expect(actual).match(/[A-Z]/);
expect(actual).match(/^[A-Z]$/);
});

it('should generate many random letters', () => {
Expand All @@ -208,7 +208,7 @@ describe('random', () => {
});

expect(actual).toHaveLength(5);
expect(actual).match(/[b-oq-z]/);
expect(actual).match(/^[b-oq-z]{5}$/);
});

it('should be able handle mistake in banned characters array', () => {
Expand All @@ -218,7 +218,7 @@ describe('random', () => {
});

expect(alphaText).toHaveLength(5);
expect(alphaText).match(/[b-oq-z]/);
expect(alphaText).match(/^[b-oq-z]{5}$/);
});
});

Expand Down Expand Up @@ -265,7 +265,7 @@ describe('random', () => {
});

expect(alphaText).toHaveLength(5);
expect(alphaText).match(/[b-oq-z]/);
expect(alphaText).match(/^[0-9b-oq-z]{5}$/);
});

it('should throw if all possible characters being banned', () => {
Expand Down

0 comments on commit 8f40d2b

Please sign in to comment.