Narrow Integration Tests
In this module, you’ll learn how to use narrow integration tests to drive the development of low-level infrastructure wrappers. You’ll build HttpClient
, an infrastructure wrapper for HTTP-based services.
Concepts
Download the slides and transcript here.
Direct links to patterns discussed in this module:
Primers
You may wish to familiarize yourself with these primers before starting on the exercises:
- JavaScript Basics
- JavaScript Concurrency
- Introduced in challenge #1:
- Introduced in challenge #7:
- Introduced in challenge #8:
- Introduced in challenge #9:
- Introduced in challenge #10:
- Introduced in challenge #11:
Exercise Setup
Start with the Overall Setup. Then:
1. Check out the code
- Check out the exercise branch:
- JavaScript:
git checkout narrow-integration-tests-js
- TypeScript:
git checkout narrow-integration-tests-ts
- JavaScript:
- Create a custom branch for your changes:
git checkout -b my-narrow-integration-tests
2. Prepare to start working
- Open the exercise files:
src/node_modules/http/_http_client_test.js
(or.ts
)src/node_modules/http/http_client.js
(or.ts
)
- Run the build watcher from the root of the repository:
- Windows:
.\watch.cmd quick
- Mac/Linux:
./watch.sh quick
- Windows:
- Confirm that the build runs and ends with
BUILD OK
.
Exercises
The course is designed to have more exercises than you can finish in a single session, so don’t worry about finishing everything. Instead, work at your own pace and focus on understanding the material.
- Challenge #1: Listening
- Challenge #2: Stopping
- Challenge #3: Requests
- Challenge #4: Responses
- Challenge #5: Request Data
- Challenge #6: Response Data
- Challenge #7: Introducing Assertions
- Challenge #8: The Spy Server
- Challenge #9: The Last Request
- Challenge #10: Set the Response
- Challenge #11: Production Code
- Challenge #12: Happy Path
- Bonus Challenges