https://www.valentinog.com/blog/jest/ Flashcards
What does testing mean?
Checking that our code meets some expectations.
What are the three main categories of testing?
Unit testing
Integration testing
UI testing
What is Jest?
A JavaScript test runner, that is, a JavaScript library for creating, running, and structuring tests.
What’s a good way to think about tests?
As bits of code that check if a given function produces the expected result.
What would a typical test flow look like?
import the function to test
give an input to the function
define what to expect as the output
check if the function produces the expected output
How would you create a new folder and initialize the project?
mkdir getting-started-with-jest && cd $_
npm init -y
How would you install jest via npm?
npm i jest –save-dev
How would you configure an NPM script for running our tests from the command line?
Open up package.json and configure the script named “test” for running Jest.
How would you open up package.json and configure the script named “test” for running Jest?
“scripts”: {
“test”: “jest”
},
What is a specification?
A written or verbal description of what to build.
What should we do for every object?
Check a property called “url”.
What happens when you check a property called “url” and the value of the property matches a given term?
Include the matching object in the resulting array.
What type of development should you follow?
test-driven development.
What does it mean to follow a test-driven development?
A discipline which imposes to write a failing test before starting to code.
Where does Jest expect to find the test files by default?
A folder called tests in your project folder.