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:
parent
26d610ca6e
commit
312103dc4f
|
@ -16,4 +16,8 @@ describe('repeatString', function() {
|
||||||
xit('returns ERROR with negative numbers', function() {
|
xit('returns ERROR with negative numbers', function() {
|
||||||
expect(repeatString('hey', -1)).toEqual('ERROR');
|
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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue