Added jest

Removed generator-exercises folder as it breaks jest-codemods

run jest-codemods on .spec.js files, move generator-exercises back in

Change references from Jasmine to Jest in main readme

Update README with Jest specific language. Update some spec files with new syntax

update tests, multiple exercises

.gitignore: Added package-lock.json, package.json that were used when I ran code-blocks over the tests.

Standardised function declaration calls across exercises

fix typo in caesar.spec.js

Ignoring package-lock.json, package.json

Backtrack on .gitignore modification, add instructions to readme

move files from testing repo to this repo

Typo fixes, remove duplicate exercise folder

Remove solution from non-solution branch

Minor grammatical fixes

added trailing semicolon to all function and module exports

Fix words caught by search/replace action.

remove doubled semicolon.

Correct words caught by search/replace action.

Add missing semicolon.

Add .DS_Store to .gitignore

multiple files: Added a blank line at the end of each file

Ignore generator-exercise when linting exercise files

Update exercise number of each exercise

Update exercise number
This commit is contained in:
Michael Frank
2021-03-03 15:13:24 +13:00
committed by Kevin Mulhern
parent 4c771f2e05
commit 5708c3d85a
53 changed files with 6259 additions and 322 deletions
+9 -2
View File
@@ -6,7 +6,7 @@ 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.
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 `.skip` from the `test.skip()` function.
## Hints
@@ -15,4 +15,11 @@ You will notice in this exercise that there are multiple tests (see in file `rep
- 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).
- If running `npm test repeatString.spec.js` returns results similar to the below:
```
Test Suites: 1 passed, 1 total
Tests: 6 skipped, 1 passed, 7 total
```
- Make sure you have enabled the rest of the tests (see above).
+2 -2
View File
@@ -1,5 +1,5 @@
const repeatString = function() {
}
};
module.exports = repeatString
module.exports = repeatString;
+8 -8
View File
@@ -1,22 +1,22 @@
const repeatString = require('./repeatString')
describe('repeatString', function() {
it('repeats the string', function() {
describe('repeatString', () => {
test('repeats the string', () => {
expect(repeatString('hey', 3)).toEqual('heyheyhey');
});
xit('repeats the string many times', function() {
test.skip('repeats the string many times', () => {
expect(repeatString('hey', 10)).toEqual('heyheyheyheyheyheyheyheyheyhey');
});
xit('repeats the string 1 times', function() {
test.skip('repeats the string 1 times', () => {
expect(repeatString('hey', 1)).toEqual('hey');
});
xit('repeats the string 0 times', function() {
test.skip('repeats the string 0 times', () => {
expect(repeatString('hey', 0)).toEqual('');
});
xit('returns ERROR with negative numbers', function() {
test.skip('returns ERROR with negative numbers', () => {
expect(repeatString('hey', -1)).toEqual('ERROR');
});
xit('repeats the string a random amount of times', function () {
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
0 to 1, when this is multiplied by 1000 and rounded down with Math.floor it
equals a number between 0 to 999 (this number will change everytime you run
@@ -31,7 +31,7 @@ describe('repeatString', function() {
was randomaly generated. */
expect(repeatString('hey', number).match(/((hey))/g).length).toEqual(number);
});
xit('works with blank strings', function() {
test.skip('works with blank strings', () => {
expect(repeatString('', 10)).toEqual('');
});
});