-
Unit Testing Fundamentals:
- The purpose of unit tests and how they fit into the software development lifecycle.
- Differences between manual testing and automated unit testing.
- Test-driven development (TDD) and the benefits of writing unit tests first.
-
Jest Basics:
- Installing Jest and setting it up for a project using npm.
- Writing simple unit tests using Jest's
test
andexpect
functions. - Understanding matchers and how to use them for various types of assertions.
- Running Jest tests using the command line and configuring Jest with a configuration file.
-
Test File Organization:
- Structuring test files using
describe
blocks to group related tests. - Using hooks (
beforeAll
,afterAll
,beforeEach
,afterEach
) to perform setup and teardown tasks.
- Structuring test files using
-
Common Matchers in Jest:
- Using matchers like
toBe
,toEqual
,toStrictEqual
,toContain
,toMatch
,toBeTruthy
,toBeFalsy
, andtoThrow
. - Differences between strict and loose equality checks in Jest.
- Using matchers like
-
Mocking and Spying:
- Creating mock functions to isolate tests and avoid dependencies on external services.
- Using Jest's automock feature to automatically mock modules.
- Writing manual mocks to customize the behavior of mocked functions.
- Using spies to monitor calls to functions and assert they were called correctly.
-
Testing Asynchronous Code:
- Writing tests for asynchronous functions using Promises, async/await, and callbacks.
- Using Jest's
resolves
andrejects
for testing promise-based code. - Ensuring tests wait for asynchronous code to complete using Jest's
done
callback.
-
Code Coverage:
- Measuring code coverage and understanding metrics like statement, branch, function, and line coverage.
- Collecting coverage statistics using Jest and configuring thresholds to enforce code quality.
-
Notifications
You must be signed in to change notification settings - Fork 0
LaunchCodeEducation/flexpath-unit-testing-with-jest-exercise-solutions
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published