mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
adding exercise for step 5
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
# Step 2.4
|
||||
|
||||
Testing Typescript code with jest.
|
||||
Testing Typescript code with jest. jest is a test framework made by Facebook and is very popular in the React and the wider JS ecosystem. We will work on implementing simple unit tests here in this exercise.
|
||||
|
||||
We won't go too deeply into mocks in this exercise, but feel free to play around with that yourself by reading up on this:
|
||||
|
||||
https://jestjs.io/docs/en/mock-functions
|
||||
|
||||
# Exercise
|
||||
|
||||
1. copy the generic `Stack<T>` code you have developed in Step 2.1
|
||||
|
||||
2. import the `Stack<T>` class into `stack.spec.ts`
|
||||
2. Run the tests by running `npm test` at the root of the bootcamp project
|
||||
|
||||
3. Follow the instructions inside the file to complete the two tests
|
||||
3. Follow the instructions inside the `stack.spec.ts` file to complete the two tests
|
||||
|
||||
8
step2-04/exercise/index.html
Normal file
8
step2-04/exercise/index.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
For this step, we look at unit testing. Run
|
||||
<pre>npm test</pre>
|
||||
in the command line.
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user