This repository contains tests for the problems in chapters 4, 5, and 13 of the Eloquent JavaScript book. The tests are written using the Jest testing framework.
-
Fork this repository
-
Clone your own repository
git clone https://github.com/MY_USERNAME/eloquentjs-problems.git
-
Open the repo in your Text Editor
-
On the command line, run:
cd eloquentjs-problems
npm install
It is recommended that you are using Node 6 or 8. If you followed my instructions during orientation, then you should have at least one of these installed. If not follow the NVM instructions here.
- Run the tests with one of the following
npm test
- will run all tests once, you may prefer the following:
npm test -- --watch
- this will run the tests and will continue watching your files for modifications and will automatically rerun your tests.
-
Add your solutions to the files:
chapter04.js
,chapter05.js
, andchapter13.js
. You do not have to modify the test fileschapter04.test.js
,chapter05.test.js
, andchapter13.test.js
. -
Commit and Push your changes.
-
Create a Pull Request to notify us of your submission.
-
DONE!
Testing is an important aspect of developing software. It ensures that we meet our initial specifications, and ensures future changes and/or optimizations do not break our software.
There are many testing frameworks available for JavaScript, all with their own merits. Here we opted for the Jest framework as it is commonly used with React, a library we will be using in this program.
To learn more about the Jest library you can start here:
and here:
and finally I recommend you go over the tests I wrote for these problems. The tests check a couple of cases for each function, but they can certainly be improved by checking more edge cases.
BONUS POINTS: If you come up with more tests, write them and create a Pull Request so we can improve this test suite together!