1 | const { expect } = require('chai');
|
2 |
|
3 | const randomStr = require('../lib/randomStr');
|
4 |
|
5 | describe('randomStr', function () {
|
6 | it('randomStr().length => 7', function () {
|
7 | expect(randomStr()).to.have.lengthOf(7);
|
8 | });
|
9 |
|
10 | it('randomStr(2).length => 2', function () {
|
11 | expect(randomStr(2)).to.have.lengthOf(2);
|
12 | });
|
13 |
|
14 | it('/[_0-9a-zA-Z]+/.test(randomStr()) => true', function () {
|
15 | expect(/[_0-9a-zA-Z]+/.test(randomStr())).to.equal(true);
|
16 | });
|
17 |
|
18 | it('/[_0-9a-zA-Z]{7}/.test(randomStr(7)) => true', function () {
|
19 | expect(/[_0-9a-zA-Z]{7}/.test(randomStr(7))).to.equal(true);
|
20 | });
|
21 |
|
22 | it('/[_0-9a-zA-Z]{17}/.test(randomStr(17)) => true', function () {
|
23 | expect(/[_0-9a-zA-Z]{17}/.test(randomStr(17))).to.equal(true);
|
24 | });
|
25 | });
|