Inspect the structure of an application to find the best things to test, and then compare different approaches for organizing unit test files.
- [Instructor] It's time to start write unit tests,…but what are we going to test?…We have a few candidates in the application.…The reservation application has a number of scripts…that are custom.…App.js is the express application itself.…It's less custom code and more of a configuration.…The server is located in bin/www.js…and sets up the HP Listener,…so not much to test there.…The library directory contains the schema for reservation,…which is really standalone.…
It also has reservations logic,…and configuration for basic auth.…Finally, there are three routes,…for admin, the homepage, and for the reservation form.…These are very thin routes,…which delegate the work to other libraries,…so they're mostly just configuration…and a little error handling.…Out of these the schema is the best place…to start with a unit test.…Let's take a look at the file itself.…In Atom in the tree view open up lib,…schema, and select reservation.js.…
It's a lightweight class with only three methods,…but it's very useful.…First is the constructor, which creates a reservation.…
- What is code quality?
- Testing and code quality fundamentals
- Coding conventions and standards
- Creating and enforcing coding standards
- Unit, integration, and functional testing
- Test-driven development test specificatons
- Behavior-driven development test specifications
- Finding errors with linting
- Extending an ESLint shareable config
- Validating correctness with unit testing
- Replacing and inspecting with stubs, spies, and mocks
- Code coverage and why it matters
- Coverage with continuous integration
Skill Level Intermediate
1. Testing and Code Quality Fundamentals
2. Finding Errors with Linting
3. Validating Correctness with Unit Testing
4. Replacing and Inspecting with Stubs, Spies, and Mocks
5. Reporting on Your Entire Codebase
Where to go from here?3m 46s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.