added alternate repeatString test strings

This commit is contained in:
kumang
2024-01-07 23:31:14 +02:00
parent b8b1ae4eda
commit 265c40fbef
2 changed files with 10 additions and 10 deletions
+5 -5
View File
@@ -5,16 +5,16 @@ describe('repeatString', () => {
expect(repeatString('hey', 3)).toEqual('heyheyhey');
});
test.skip('repeats the string many times', () => {
expect(repeatString('hey', 10)).toEqual('heyheyheyheyheyheyheyheyheyhey');
expect(repeatString('hello', 10)).toEqual('hellohellohellohellohellohellohellohellohellohello');
});
test.skip('repeats the string 1 times', () => {
expect(repeatString('hey', 1)).toEqual('hey');
expect(repeatString('hi', 1)).toEqual('hi');
});
test.skip('repeats the string 0 times', () => {
expect(repeatString('hey', 0)).toEqual('');
expect(repeatString('bye', 0)).toEqual('');
});
test.skip('returns ERROR with negative numbers', () => {
expect(repeatString('hey', -1)).toEqual('ERROR');
expect(repeatString('goodbye', -1)).toEqual('ERROR');
});
test.skip('repeats the string a random amount of times', function () {
/*The number is generated by using Math.random to get a value from between
@@ -29,7 +29,7 @@ describe('repeatString', () => {
/*The .match(/((hey))/g).length is a regex that will count the number of heys
in the result, which if your function works correctly will equal the number that
was randomly generated. */
expect(repeatString('hey', number).match(/((hey))/g).length).toEqual(number);
expect(repeatString('odin', number).match(/((odin))/g).length).toEqual(number);
});
test.skip('works with blank strings', () => {
expect(repeatString('', 10)).toEqual('');