diff --git a/step2-03/README.md b/step2-03/demo/README.md similarity index 75% rename from step2-03/README.md rename to step2-03/demo/README.md index 8962923..87c217f 100644 --- a/step2-03/README.md +++ b/step2-03/demo/README.md @@ -1,4 +1,4 @@ -# Step 2.3: Theming and styling with UI Fabric +# Step 2.3: Theming and styling with UI Fabric (Demo) [Lessons](../) | [Exercise](./exercise/) | [Demo](./demo/) @@ -146,64 +146,3 @@ const className = mergeStyles(blueBackgroundClassName, { const myDiv =
npm testdiff --git a/step2-04/exercise/README.md b/step2-04/exercise/README.md new file mode 100644 index 0000000..88880c0 --- /dev/null +++ b/step2-04/exercise/README.md @@ -0,0 +1,19 @@ +# Step 2.4: Testing TypeScript code with Jest (Exercise) + +[Lessons](../) | [Exercise](./exercise/) | [Demo](./demo/) + +# Exercise + +Start the test runner by running `npm test` in the root of the `frontend-bootcamp` folder. + +## Basic testing + +1. Look at `exercise/src/stack.ts` for a sample implementation of a stack + +2. Follow the instructions inside `stack.spec.ts` file to complete the two tests + +## Enzyme Testing + +1. Open up `exercise/src/TestMe.spec.tsx` + +2. Fill in the test using Enzyme concepts introduced in the demo diff --git a/step2-04/exercise/index.html b/step2-04/exercise/index.html index 50d9fb4..e908cc3 100644 --- a/step2-04/exercise/index.html +++ b/step2-04/exercise/index.html @@ -4,7 +4,7 @@ - +
npm testdiff --git a/step2-05/README.md b/step2-05/demo/README.md similarity index 84% rename from step2-05/README.md rename to step2-05/demo/README.md index 88afced..d9f262a 100644 --- a/step2-05/README.md +++ b/step2-05/demo/README.md @@ -1,4 +1,4 @@ -# Step 2.5: Redux: Reducers +# Step 2.5: Redux: Reducers (Demo) [Lessons](../) | [Exercise](./exercise/) | [Demo](./demo/) @@ -26,7 +26,7 @@ A view is a React components that consumes the store as its data. There is a spe ### Action -Actions are messages that represent some event, such as a user's action or a network request. With the aid of *reducers*, they affect the overall state. +Actions are messages that represent some event, such as a user's action or a network request. With the aid of _reducers_, they affect the overall state. ### Store @@ -99,15 +99,3 @@ function reducer(state: Store['todos'], payload: any): Store['todos'] { ``` In the demo and exercises for this step, I separated the pure and reducer functions into different files to make it cleaner. The tests inside `pureFunctions.spec.ts` should describe the behavior of the individual functions. They are easy to follow and easy to write. - -# Exercise - -If you still have the app running from a previous step, stop it with `ctrl+c`. Start the tests instead by running `npm test` from the root of the `frontend-bootcamp` folder. - -1. First, take a look at the store interface in `exercise/src/store/index.ts`. Note that the `Store` interface has two keys: `todos` and `filter`. We'll concentrate on `todos`, which is an object where the keys are string IDs and the values are of a `TodoItem` type. - -2. Open `exercise/src/reducers/pureFunctions.ts` and fill in the missing function bodies. - -3. Open `exercise/src/reducers/index.ts` and fill in the missing case statements for the switch on `action.type`. - -4. Open `exercise/src/reducers/pureFunctions.spec.ts` and implement tests for the functions you wrote for `remove`, `complete`, and `clear`. diff --git a/step2-05/demo/index.html b/step2-05/demo/index.html index 50d9fb4..92a9499 100644 --- a/step2-05/demo/index.html +++ b/step2-05/demo/index.html @@ -4,7 +4,7 @@ - +
npm testdiff --git a/step2-05/exercise/README.md b/step2-05/exercise/README.md new file mode 100644 index 0000000..117fbeb --- /dev/null +++ b/step2-05/exercise/README.md @@ -0,0 +1,15 @@ +# Step 2.5: Redux: Reducers (Exercise) + +[Lessons](../) | [Exercise](./exercise/) | [Demo](./demo/) + +# Exercise + +If you still have the app running from a previous step, stop it with `ctrl+c`. Start the tests instead by running `npm test` from the root of the `frontend-bootcamp` folder. + +1. First, take a look at the store interface in `exercise/src/store/index.ts`. Note that the `Store` interface has two keys: `todos` and `filter`. We'll concentrate on `todos`, which is an object where the keys are string IDs and the values are of a `TodoItem` type. + +2. Open `exercise/src/reducers/pureFunctions.ts` and fill in the missing function bodies. + +3. Open `exercise/src/reducers/index.ts` and fill in the missing case statements for the switch on `action.type`. + +4. Open `exercise/src/reducers/pureFunctions.spec.ts` and implement tests for the functions you wrote for `remove`, `complete`, and `clear`. diff --git a/step2-05/exercise/index.html b/step2-05/exercise/index.html index 50d9fb4..e908cc3 100644 --- a/step2-05/exercise/index.html +++ b/step2-05/exercise/index.html @@ -4,7 +4,7 @@ - +
npm test