Fork from => https://gitlab.com/reggermont-teaching/tdd/tdd-course
- Node LTS
- (Facultative) Docker
- (Facultative) Makefile
- Install dependencies:
yarn
- Compile the app dynamically:
yarn dev
- Get list of all commands:
./cli.js -h
- Run specific command:
./cli.js <COMMAND>
- Compile the app dynamically:
yarn test
- Install dependencies:
docker run --rm -v "$(pwd)":/app -w /app node:lts bash -c 'yarn
- Compile the app dynamically:
docker run --rm -v "$(pwd)":/app -w /app node:lts bash -c 'yarn dev
- Get list of all commands:
docker run --rm -v "$(pwd)":/app -w /app node:lts bash -c './cli.js -h'
- Run specific command:
docker run --rm -v "$(pwd)":/app -w /app node:lts bash -c './cli.js <COMMAND>'
- Run tests:
docker run --rm -v "$(pwd)":/app -w /app node:lts bash -c 'yarn test'
- Compile the app dynamically (see above)
- Open the
src/controllers/word-counter.js
file and take a look at the wordCounter function that return the number of words in a string. - Now open the
src/controllers/__tests__/word-counter.test.js
file and write as many tests as you can for all the scenarios you have in mind (At least 4 required) - When it's done, run the tests (see above)
- If you did your job well, the app should break for specific scenarios. Change the wordCounter function to make all tests pass
Tuesday, May 4th before 11:59PM
Following sentenceWordCounterWrite example, write BDD process and unit / integrations tests for the following new functions:
- New helper that open a file and return its content => fileReader
- Provide a text file path and returns the number of words => fileWordCounter
- Provide a text and returns the mistakes => spellingChecker
- Provide a text and fixes the mistakes => spellingFixer
- Provide a text file path and returns the mistakes => spellingChecker
- Provide a text file path and fixes the mistakes => fileSpellingFixer
Those new functions are located in those 3 files:
src/controllers/word-counter.js
src/controllers/spelling-checker.js
src/helpers/fileReader.js
As a "bonus", you can fill the functions with working code, but that's should not be your main focus. As a reference, the rate chart will be the following:
- 18 points for the BDD + Tests
- 2 points for the functions
- All functions in
src/controllers
files aim to be cli commands, unlike functions insrc/helpers
files which aim to be helpers for other functions - If the function is located in
src/helpers/filePath.js
, then its BDD specs must be located insrc/helpers/__tests__/filePath.feature
and its unit / integration tests insrc/helpers/__tests__/filePath.test.js
. For the files structure, checksrc/controllers/__tests__/word-counter.feature
andsrc/controllers/__tests__/word-counter.test.js
Zip of the folder (without node_mudules folder, please) on MyGES. For that, use git archive command