Let’s practice! This testing thing really is not that difficult, but it is quite new. The only way to get comfortable with it is to spend some time doing it.
Write tests for the following functions, and then make the tests pass!
capitalize(string)
takes a string and returns that string with the first character capitalized.
reverseString(string)
takes a string and returns it reversed.
A calculator
object that contains the basic operations: add
, subtract
, divide
, and multiply
.
Caesar Cipher. Read about it on this website
z
to a
.caesar()
function. If it works as expected you can rest assured that your smaller helper functions are doing what they’re supposed to.Array Analysis. Write a function that takes an array of numbers and returns an object with the following properties: average
, min
, max
, and length
.
const object = analyze([1,8,3,4,2,6]);
object == {
average: 4,
min: 1,
max: 8,
length: 6
};
By default, the current version of Jest will not recognize ES6 import statements. In order for you to be able to use ES6 modules for this project you may do the following:
npm i -D @babel/preset-env
{
"presets": ["@babel/preset-env"]
}
This will allow you to use import statements. Note that in the Jest docs a similar instruction is laid out here
5-6 months
Job Guarantee
1-on-1 Mentorship