Added random test

I added a random test getting a number from 1 to 1000. You said you wanted comments on it but I was not sure where to put them. I added the global modifier to the recommended regex in order for it count all the words properly.
This commit is contained in:
Christopher Martinez 2020-05-01 12:44:55 -05:00 committed by GitHub
parent 26d610ca6e
commit 312103dc4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -16,4 +16,8 @@ describe('repeatString', function() {
xit('returns ERROR with negative numbers', function() {
expect(repeatString('hey', -1)).toEqual('ERROR');
});
xit('repeats the string a random amount of times', function () {
let number = Math.floor(Math.random() * 1000)
expect(repeatString('hey', number).match(/((hey))/g).length).toEqual(number);
});
});