Step 1. Structure of tests and syntax for test in JS
Create the file for the tests
- JS: Make sure to include ".test.js" in the end of the filename
Create a named test with a function (JS) method (Java)
Step 2. introduce "matchers" or "assertions"
- JS: For a list of common matchers, refer to Jest Documentation
Step 3. Create a test to verify if a vehicle is affordable.
- Create a test to verify if a sentence ends with a period.
Create a new test file
Declare a list of String with Swedish greetings.
Create some tests to verify:
- If the list contains common Swedish greetings
- If the list does not contain English greeting
- If the list does not contain goodbye greeting
This time, code a function that should verify if a sentence ends with a period. Then test it!