Codewars
Challenges from Codewars, adding testing with Mocha and Chai.
Run tests
npm install
npm run test
Challenges
Credit Card Mask
-
Code : maskify.js
-
Test: maskify-test.js
Disemvowel Trolls
-
Code : disemvowel.js
-
Test: disemvowel-test.js
Two to One
-
Code : longest.js
-
Test: longest-test.js
How to add testing
- Create the package.json file:
touch package.json
echo {} > package.json
- Install mocha:
npm install mocha --save-dev
- Install chai:
npm install chai --save-dev
- Add in package.json:
"scripts": {
"test": "mocha tests/*-test.js"
}
- Add the test and execute:
npm run test