September 2018
Intermediate to advanced
328 pages
9h 10m
English
All of the code used in this example is located in the /chapter-09-node/testing-example folder. The code and corresponding tests are very simple and are not representative of real-world applications, but they're intended to demonstrate how to use Jest for testing. The following code represents the file structure of the /testing-example folder:
├── /src| ├── /__tests__| │ └── main.test.js| └── main.c├── package.json└── package-lock.json
The contents of the C file that we'll test, /src/main.c, is shown as follows:
int addTwoNumbers(int leftValue, int rightValue) { return leftValue + rightValue;}float divideTwoNumbers(float leftValue, float rightValue) { return leftValue / rightValue;}double findFactorial(float value) { ...Read now
Unlock full access