▸case-01 We are building a Node.js REST API in TypeScript and need to write unit tests for a payment service that calls an external API. Could you walk us through how to structure these tests, isolate the network dependencies using mocks, and verify success and error paths? | fail→fail | 18,861 | 21,088 | +12% | 1 | 1 | 0% | 3,836 | 3,929 | +2% | 0 | 0 | — |
▸case-02 I'm developing a React application with a multi-step user registration flow. What is the best way to write component tests using React Testing Library to cover async form submissions, input validation, and user navigation? | fail→fail | 18,568 | 16,152 | -13% | 1 | 1 | 0% | 3,674 | 3,332 | -9% | 0 | 0 | — |
▸case-03 Our frontend and backend teams are setting up a modern JavaScript project from scratch. Can you provide a comprehensive testing plan covering unit, integration, and end-to-end testing, along with step-by-step instructions for running them in a continuous integration pipeline? | fail→fail | 25,104 | 22,123 | -12% | 1 | 1 | 0% | 4,935 | 4,827 | -2% | 0 | 0 | — |
▸case-04 We are building a backend service in Python using Pytest and need to write tests for an async PostgreSQL database repository using asyncpg. How should we structure our Pytest fixtures for test database transactions and rollback? | pass→pass | 18,219 | 13,707 | -25% | 1 | 1 | 0% | 3,361 | 2,686 | -20% | 0 | 0 | — |
▸case-05 We need to set up a Selenium Grid infrastructure in Docker for cross-browser automated testing, using Python with pytest-xdist to distribute test execution across Chrome and Firefox nodes. How should we configure the docker-compose setup for the grid router and browser nodes? | pass→pass | 19,945 | 14,964 | -25% | 1 | 1 | 0% | 3,837 | 3,158 | -18% | 0 | 0 | — |
▸case-06 We are developing a C++ high-performance engine and need to write unit tests using GoogleTest (gtest) and GoogleMock (gmock) for a thread-safe lock-free queue. How should we write gtest assertions and mock class definitions? | pass→pass | 21,536 | 22,867 | +6% | 1 | 1 | 0% | 4,190 | 5,049 | +21% | 0 | 0 | — |
▸case-07 We have a JavaScript utility module that parses complex date strings and computes business day offsets. Developers currently test it by running a single manually written happy-path assertion in a script. We want to convert this to proper unit testing using standard JS test frameworks. What methodology and test case structure should we use to test boundary conditions like leap years and month overflows? | pass→pass | 18,780 | 17,116 | -9% | 1 | 1 | 0% | 3,697 | 3,393 | -8% | 0 | 0 | — |
▸case-08 In our React and Node.js application, developers are mocking fetch globally by overwriting globalThis.fetch with custom jest.fn() mocks inside every individual test file, leading to fragile tests and leaked mock states across tests. What is the recommended modern pattern for intercepting network requests at the network layer in JavaScript applications? | pass→pass | 14,869 | 11,266 | -24% | 1 | 1 | 0% | 2,711 | 2,324 | -14% | 0 | 0 | — |
▸case-09 Our team is testing React form components and uses fireEvent.change to simulate typing into input fields. However, event handlers like onFocus, onKeyDown, and character-by-character validation aren't triggering as they would in a real browser. How should we rewrite component interactions to closely simulate real user browser behavior? | pass→pass | 13,019 | 16,973 | +30% | 1 | 1 | 0% | 2,416 | 2,843 | +18% | 0 | 0 | — |
▸case-10 We have an Express backend service in Node.js where unit tests currently spin up a live HTTP server on a random port for every single unit test run, causing slow test execution and port collisions in CI. How can we isolate service logic without starting actual HTTP servers? | fail→fail | 16,019 | 11,852 | -26% | 1 | 1 | 0% | 2,910 | 2,446 | -16% | 0 | 0 | — |
▸case-11 Our TypeScript test suite using Jest takes over 5 minutes to run because ts-jest performs full type checking on every test run. How should we optimize the test execution speed while maintaining type safety in our build pipeline? | fail→fail | 12,690 | 11,922 | -6% | 1 | 1 | 0% | 2,372 | 2,525 | +6% | 0 | 0 | — |
▸case-12 In a Vue 3 composition API application, developers are testing parent components by mounting all child components recursively, which makes unit tests break whenever any child component changes internal markup. How should component unit tests isolate the component under test? | pass→pass | 14,982 | 14,279 | -5% | 1 | 1 | 0% | 2,776 | 2,725 | -2% | 0 | 0 | — |
▸case-13 Our end-to-end automated test suite in Playwright frequently breaks whenever designers update CSS classes or refactor tailwind utility classes on HTML buttons. Developers currently use selectors like page.locator('.btn.btn-primary.mt-4'). What selector strategy should we adopt to make E2E tests resilient to visual restyling? | pass→pass | 15,081 | 12,863 | -15% | 1 | 1 | 0% | 2,506 | 2,548 | +2% | 0 | 0 | — |
▸case-14 We are writing integration tests for an Express REST API connected to a PostgreSQL database via Knex. Currently, running tests repeatedly leaves leftover records in the database, causing subsequent test runs to fail due to primary key conflicts. What is the standard pattern for handling database state in Node.js API integration tests? | fail→fail | 15,117 | 14,301 | -5% | 1 | 1 | 0% | 2,709 | 2,858 | +6% | 0 | 0 | — |
▸case-15 Our team wants to adopt Test-Driven Development for building a financial transaction calculation module in TypeScript. Developers are unsure about the sequence of steps and how to handle refactoring safely. Can you detail the core operational cycle of TDD for this module? | pass→pass | 18,179 | 18,125 | -0% | 1 | 1 | 0% | 3,346 | 3,947 | +18% | 0 | 0 | — |
▸case-16 In our JavaScript application, a module uses jest.spyOn(console, 'error') to verify error logging. However, after the test suite finishes, other tests no longer log errors to stdout, breaking debugging across the rest of the runner. What must be done when using function spies? | pass→pass | 7,474 | 8,398 | +12% | 1 | 1 | 0% | 1,370 | 1,720 | +26% | 0 | 0 | — |
▸case-17 Our Playwright visual regression tests compare screenshots using pixel-by-pixel comparisons, but tests fail in CI because CI container font rendering differs slightly from local macOS developer machines. How should visual screenshot comparisons be configured to prevent local vs CI false positives? | pass→pass | 14,780 | 17,610 | +19% | 1 | 1 | 0% | 2,641 | 2,917 | +10% | 0 | 0 | — |
▸case-18 Developers are writing asynchronous Jest unit tests using callback functions with the done parameter, but tests frequently hang indefinitely or fail silently when an assertion throws an error inside an async callback. What modern JavaScript pattern should be used for testing promises? | pass→pass | 9,653 | 8,723 | -10% | 1 | 1 | 0% | 1,809 | 1,840 | +2% | 0 | 0 | — |
▸case-19 We have two independent microservices communicating via REST in Node.js. Integration tests fail regularly in staging because backend developers change response payload keys without notifying frontend developers. What architectural testing pattern verifies contract compatibility between consumer and provider services before deployment? | pass→pass | 12,913 | 12,830 | -1% | 1 | 1 | 0% | 2,252 | 2,505 | +11% | 0 | 0 | — |
▸case-20 Our team generated large Jest snapshots for entire HTML DOM trees across 50 components. Now, developers indiscriminately update snapshots whenever tests fail without reading diffs, letting UI regressions slip into production. How should snapshot testing be used properly in frontend JavaScript applications? | pass→pass | 19,340 | 15,653 | -19% | 1 | 1 | 0% | 2,675 | 2,840 | +6% | 0 | 0 | — |
▸case-21 Our JavaScript project has 2,000 unit and integration tests running sequentially in GitHub Actions, taking 25 minutes. How should we configure test runner execution and CI workflow jobs to reduce pipeline execution time? | fail→fail | 18,735 | 16,213 | -13% | 1 | 1 | 0% | 3,340 | 2,968 | -11% | 0 | 0 | — |
▸case-22 We have a JavaScript session timeout manager that uses setTimeout and Date.now(). Unit tests for a 30-minute timeout take 30 minutes to execute because they use real setTimeout. How can we test time-dependent functions instantly without real delays? | pass→pass | 11,913 | 13,313 | +12% | 1 | 1 | 0% | 2,506 | 3,021 | +21% | 0 | 0 | — |
▸case-23 When running Playwright end-to-end tests for a web frontend, third-party analytics and chat widget requests slow down test runs and cause random failures. How should E2E tests isolate the browser from non-essential third-party network services? | fail→fail | 15,206 | 14,492 | -5% | 1 | 1 | 0% | 2,809 | 3,151 | +12% | 0 | 0 | — |
▸case-24 We are developing a data visualization component in HTML5 Canvas using TypeScript. When running unit tests in Node.js with jsdom, canvas.getContext('2d') returns null and throws errors during rendering tests. How should we mock canvas context rendering methods in Jest or Vitest environments? | pass→fail | 15,856 | 17,410 | +10% | 1 | 1 | 0% | 3,134 | 3,592 | +15% | 0 | 0 | — |
▸case-25 We have a custom React hook useFormValidation that manages custom form state and async validation logic. Developers are creating temporary fake React components just to test this hook's return values, leading to boilerplated test code. What is the standard pattern for testing custom React hooks directly? | pass→pass | 12,234 | 9,497 | -22% | 1 | 1 | 0% | 2,535 | 2,159 | -15% | 0 | 0 | — |