Let’s say you’re building an app for your smart fridge, and you want it to be able to tell you which ingredients you have could go into a salad?
-
Fork this repo to your account
-
Clone down the repo:
git clone <YOUR_BRANCH_URL>
-
Open the repo in you terminal:
cd fridge-exercise
-
Install the project:
npm i # shorter version of npm install
-
Create a solution branch:
git checkout -b solution
-
Run the tests:
npm test # they will fail to run. We haven't written any code yet.
-
Open VSCode by typing
code .
or by opening it mannually and navigating to the kata folder/directory -
In
fridge.js
, declare a function calledfindIngredients
. Leave the function body empty for now.Export
your function at the bottom of the file with:module.exports = findIngredients;
-
Commit and push your work to github
-
Look at
test/fridge.test.js
, what is the first test expecting? - can you write it inpseudocode
? Which steps would it take? -
Write the code to pass the first test. Keep a terminal window open and run your test by doing
npm test
ornpm t
-
Things to nose at:
- Jest: https://jestjs.io/
- Test driven development (TDD): https://medium.com/javascript-scene/tdd-changed-my-life-5af0ce099f80 AND https://www.freecodecamp.org/news/ an-introduction-to-test-driven-development-c4de6dce5c/
- Git ignore: https://git-scm.com/docs/gitignore
- package.json: https://flaviocopes.com/package-json/
- module.exports and require: https://www.sitepoint.com/understanding-module-exports-exports-node-js/