Skip to content

Commit

Permalink
Add test for checking if right square bracket is properly excluded
Browse files Browse the repository at this point in the history
  • Loading branch information
ywpark1 committed Oct 4, 2018
1 parent 8688dcf commit a04548e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ describe('randomatic', function() {
assert.equal(actual.length, 16);
});

it('should generate a random string excluding right square bracket on the `exclude` option', function() {
var actual = randomize('*', 16, {exclude: ']'});
assert(test(/[^\]]{16}/, actual));
assert.equal(actual.length, 16);
});

it('should generate a random string excluding array with one element(right square bracket) on the `exclude` option', function() {
var actual = randomize('*', 16, {exclude: [']']});
assert(test(/[^\]]{16}/, actual));
assert.equal(actual.length, 16);
});

it('should generate a radomized 16-character string', function() {
assert.equal(randomize('*', 16).length, 16);
});
Expand Down

0 comments on commit a04548e

Please sign in to comment.