From caf69daa5f174a90344dd4cbb611d591da4a2885 Mon Sep 17 00:00:00 2001 From: billalp Date: Sun, 3 Nov 2019 22:34:32 +0000 Subject: [PATCH] Starting exrcise --- repeatString/README.md | 7 +------ repeatString/repeatString.spec.js | 4 ++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/repeatString/README.md b/repeatString/README.md index e19a080..00cbfbd 100644 --- a/repeatString/README.md +++ b/repeatString/README.md @@ -6,13 +6,8 @@ Write a function that simply repeats the string a given number of times: repeatString('hey', 3) // returns 'heyheyhey' ``` -You will notice in this exercise that there are multiple tests (see in file `repeatString.spec.js`). Only the first test is currently enabled. So after making sure that this first one passes, enable the others one by one by deleting the `x` in front of the `it()` function. - - ## Hints - You're going to want to use a loop for this one. -- Create a variable to hold the string you're going to return, create a loop that repeats the given number of times and add the given string to the result on each loop. - -- If running `jasmine repeatString.spec.js` raises `Temporarily disabled with xit` errors, make sure you have enabled the rest of the tests (see above). +- Create a variable to hold the string you're going to return, create a loop that repeats the given number of times and add the given string to the result on each loop. \ No newline at end of file diff --git a/repeatString/repeatString.spec.js b/repeatString/repeatString.spec.js index 931b437..0667ca8 100644 --- a/repeatString/repeatString.spec.js +++ b/repeatString/repeatString.spec.js @@ -4,15 +4,19 @@ describe('repeatString', function() { it('repeats the string', function() { expect(repeatString('hey', 3)).toEqual('heyheyhey'); }); + xit('repeats the string many times', function() { expect(repeatString('hey', 10)).toEqual('heyheyheyheyheyheyheyheyheyhey'); }); + xit('repeats the string 1 times', function() { expect(repeatString('hey', 1)).toEqual('hey'); }); + xit('repeats the string 0 times', function() { expect(repeatString('hey', 0)).toEqual(''); }); + xit('returns ERROR with negative numbers', function() { expect(repeatString('hey', -1)).toEqual('ERROR'); });