passed ERROR test
This commit is contained in:
parent
1149e755e5
commit
52356b2eb6
|
@ -2,13 +2,12 @@ const repeatString = function(string, number) {
|
||||||
|
|
||||||
let result = '';
|
let result = '';
|
||||||
|
|
||||||
|
if (number < 0) {
|
||||||
|
return 'ERROR';
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < number; i++) {
|
for (let i = 0; i < number; i++) {
|
||||||
if (number < 0) {
|
|
||||||
return 'ERROR';
|
|
||||||
}
|
|
||||||
|
|
||||||
result += string;
|
result += string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -13,7 +13,7 @@ describe('repeatString', function() {
|
||||||
it('repeats the string 0 times', function() {
|
it('repeats the string 0 times', function() {
|
||||||
expect(repeatString('hey', 0)).toEqual('');
|
expect(repeatString('hey', 0)).toEqual('');
|
||||||
});
|
});
|
||||||
xit('returns ERROR with negative numbers', function() {
|
it('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() {
|
xit('repeats the string a random amount of times', function() {
|
||||||
|
|
Loading…
Reference in New Issue