🌍 ReactJS · subject

ReactJS Testing in React Syllabus

Every chapter and topic of Testing in React examined in ReactJS — 3 chapters, 9 topics, plus 51 flashcards written against it.

3Chapters
9Topics
0Sub-topics
~7hEst. first pass
10%Of ReactJS
51Flashcards

Testing in React syllabus — full chapter and topic list

Expand any chapter to see its topics and sub-topics. This is the whole examinable outline for Testing in React in ReactJS, not a summary of it.

  1. Unit Testing

    3 topics
    • Setting Up Jest
    • Writing Unit Tests
    • Testing Components
  2. Integration Testing

    3 topics
    • Setting Up Testing Library
    • Writing Integration Tests
    • Testing User Interactions
  3. End-to-End Testing

    3 topics
    • Setting Up Cypress
    • Writing End-to-End Tests
    • Running Tests in CI/CD

Testing in React flashcards for ReactJS

19 of 51 cards from the Testing in React deck — real questions with worked answers.

  1. What is Jest?

    Jest is a JavaScript testing framework maintained by Meta that provides a test runner, assertion library, mocking utilities, and code-coverage reporting in a single zero-config package.

  2. Which command installs Jest as a development dependency in an npm project?

    npm install --save-dev jest

  3. In package.json, how do you configure the standard script to run Jest?

    Add "scripts": { "test": "jest" } so that running npm test invokes Jest.

  4. By default, which file naming patterns does Jest treat as test files?

    Files ending in .test.js or .spec.js, and any file located inside a __tests__ directory.

  5. What is the purpose of a jest.config.js file?

    It centralizes Jest configuration (test environment, module mappers, setup files, coverage settings, transforms) so options don't have to be passed on the command line.

  6. For testing React components that touch the DOM, which Jest testEnvironment must be set?

    testEnvironment: 'jsdom' (jsdom simulates a browser DOM in Node); in older Jest it was the default, but Jest 27+ defaults to 'node'.

  7. Which Babel or transform tooling lets Jest understand JSX and modern ES syntax?

    babel-jest together with @babel/preset-env and @babel/preset-react (configured via babel.config.js), or ts-jest for TypeScript.

  8. What is the difference between the Jest globals describe() and test()/it()?

    describe() groups related tests into a block (a test suite), while test() (aliased it()) defines an individual test case containing assertions.

  9. What is a unit test?

    A unit test verifies the smallest testable piece of code (a single function, module, or component) in isolation from its dependencies, confirming it behaves correctly for given inputs.

  10. What is the standard three-part structure (pattern) for organizing the body of a unit test?

    Arrange-Act-Assert (AAA): arrange the inputs/state, act by invoking the code under test, then assert the expected outcome.

  11. In Jest, what does the expect() function return and how is it used?

    expect(value) wraps the actual value and returns an 'expectation' object exposing matcher methods (e.g., .toBe, .toEqual) that assert conditions about it.

  12. What is the difference between the Jest matchers toBe() and toEqual()?

    toBe() checks strict referential/primitive equality (Object.is), while toEqual() recursively checks structural (deep) value equality of objects and arrays.

  13. Which Jest matcher asserts that a function throws an error when called?

    expect(() => fn()).toThrow() — the code under test must be wrapped in a function so Jest can invoke it and catch the error.

  14. How do you assert the opposite of a matcher in Jest?

    Chain .not before the matcher, e.g., expect(value).not.toBe(5).

  15. What is a mock function in Jest and how do you create one?

    A mock function records calls, arguments, and return values so you can assert on interactions; create one with jest.fn(), optionally giving it an implementation or return value.

  16. What does jest.mock('module-path') do?

    It automatically replaces the specified module with an auto-mocked version whose functions are jest.fn() stubs, isolating the unit under test from that dependency.

  17. What is the purpose of the beforeEach() and afterEach() hooks in Jest?

    beforeEach() runs setup code before every test in scope and afterEach() runs teardown after every test, ensuring each test starts from a clean, consistent state.

  18. How do you run a single test or focus on a subset in Jest?

    Use test.only() / describe.only() to run only that block, or test.skip() to skip; from the CLI use jest -t 'name pattern'.

  19. What flag makes Jest generate a code-coverage report?

    jest --coverage, which outputs statement, branch, function, and line coverage percentages.

See more Testing in React flashcards →

Planning Testing in React for ReactJS

Testing in React is about 10% of the ReactJS syllabus by topic count — 9 of 93 topics, spread over 3 chapters. At roughly 45 minutes per topic plus 12 minutes per sub-topic, a first pass runs to about 7 hours.

The heaviest chapters are Unit Testing (3 topics), Integration Testing (3 topics), End-to-End Testing (3 topics) . Front-load those while your energy is high; the short chapters are better revision filler later.

Work top-down: read the chapter, then tick topics off individually rather than marking the whole chapter done. Sub-topics are where silent gaps hide.

Testing in React (ReactJS) FAQ

What is in the ReactJS Testing in React syllabus?

Testing in React is split into 3 chapters — Unit Testing, Integration Testing and End-to-End Testing, containing 9 topics and 0 sub-topics in total.

How many chapters are there in Testing in React for ReactJS?

3 chapters. Testing in React accounts for about 10% of the topics in the whole ReactJS syllabus (9 of 93).

How long should I spend on Testing in React for ReactJS?

Budget around 7 hours for a first pass through Testing in React — about 45 minutes per topic plus 12 minutes per sub-topic across its 9 topics. Add revision cycles on top.

Are there flashcards for ReactJS Testing in React?

Yes — a 51-card Testing in React deck. Sample cards are printed on this page, and the full deck is free in the Examius app with spaced repetition scheduling.