โ† All Web Development Flashcard Decks

Testing Flashcards

7 cards from real Web Development practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Testing flashcards as text
  1. Which assertion library method in Chai verifies that a value is strictly equal using `===`?

    Answer: .equal()

    Chai's `.equal()` uses strict equality (`===`), while `.eql()` performs a deep equality check for objects and arrays.

  2. What is the primary goal of mutation testing?

    Answer: To measure how well your tests detect deliberate bugs introduced into the code

    Mutation testing tools (like Stryker) introduce small code changes (mutations) and check if your tests catch them, revealing gaps in test quality.

  3. In end-to-end testing, what is a 'Page Object Model' (POM)?

    Answer: A design pattern that encapsulates page interactions into reusable classes

    The Page Object Model abstracts UI interactions into dedicated classes, reducing code duplication and making tests easier to maintain.

  4. What does `act()` in React Testing Library help with?

    Answer: Ensuring all state updates and effects are applied before making assertions

    `act()` wraps code that triggers React state updates, ensuring the component re-renders and effects complete before assertions are evaluated.

  5. Which HTTP method should an API endpoint test use to verify idempotent resource deletion?

    Answer: DELETE

    DELETE is the idempotent method for removing resources; calling it multiple times should result in the same state (resource gone).

  6. In a CI pipeline, at which stage is it most appropriate to run unit tests?

    Answer: Before building the application artifact

    Unit tests are fast and should run early in CI (before building) to fail fast and give developers immediate feedback on broken logic.

  7. What does the `--watch` flag do when running Jest?

    Answer: Re-runs tests automatically when source files change

    Jest's `--watch` mode monitors the file system and re-runs relevant tests whenever you save a file, enabling a fast feedback loop during development.

How this page was made: written with AI tools. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Not reviewed by a subject-matter expert. Editorial policy