Skip to content

Latest commit

 

History

History
36 lines (28 loc) · 1.98 KB

File metadata and controls

36 lines (28 loc) · 1.98 KB

Summary of JavaScript Concepts Covered in These Exercises

  1. 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.
  2. Jest Basics:

    • Installing Jest and setting it up for a project using npm.
    • Writing simple unit tests using Jest's test and expect 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.
  3. 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.
  4. Common Matchers in Jest:

    • Using matchers like toBe, toEqual, toStrictEqual, toContain, toMatch, toBeTruthy, toBeFalsy, and toThrow.
    • Differences between strict and loose equality checks in Jest.
  5. 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.
  6. Testing Asynchronous Code:

    • Writing tests for asynchronous functions using Promises, async/await, and callbacks.
    • Using Jest's resolves and rejects for testing promise-based code.
    • Ensuring tests wait for asynchronous code to complete using Jest's done callback.
  7. 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.