8000 Added random test · M-Munk/javascript-exercises@312103d · GitHub
[go: up one dir, main page]

Skip to content

Commit 312103d

Browse files
authored
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.
1 parent 26d610c commit 312103d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

repeatString/repeatString.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@ describe('repeatString', function() {
1616
xit('returns ERROR with negative numbers', function() {
1717
expect(repeatString('hey', -1)).toEqual('ERROR');
1818
});
19+
xit('repeats the string a random amount of times', function () {
20+
let number = Math.floor(Math.random() * 1000)
21+
expect(repeatString('hey', number).match(/((hey))/g).length).toEqual(number);
22+
});
1923
});

0 commit comments

Comments
 (0)
0