One search. Connected ideas.
Find the lesson, understand the concept, and prepare your answer.
10 results shown · grouped by type
Technologies1
Choose useful tests and understand mocks, fixtures, and coverage.
Lessons4
Jest provides test execution, assertions and tools for replacing dependencies. React Testing Library helps test components through behavior visible to users, while Supertest sends HTTP requests to an application for API assertions. They can be combined, but none automatically chooses meaningful cases or guarantees realism.
Unit tests check a small piece of logic, integration tests verify collaborating components, and E2E tests exercise a complete user or API flow. They catch different classes of failure and have different setup and execution costs. A balanced strategy puts detailed business-rule checks near the unit level and preserves real integration coverage where mocks would hide bugs.
Test doubles replace real collaborators so a test can control conditions or observe interactions. A stub supplies a response, a spy records calls, and a mock often combines replacement with expected interactions; terminology varies by library. Fixtures supply stable input data so cases are repeatable.
Coverage measures which lines, branches or functions executed while tests ran. It can reveal untested areas, but execution does not prove that the assertions checked correct behavior. A suite can reach every line and still miss invalid inputs, race conditions or a wrong expected value.
Interview questions4
Unit tests check a small piece of logic, integration tests verify collaborating components, and E2E tests exercise a complete user or API flow. They catch different classes of failure and have different setup and execution costs. A balanced strategy puts detailed business-rule checks near the unit level and preserves real integration coverage where mocks would hide bugs.
Jest provides test execution, assertions and tools for replacing dependencies. React Testing Library helps test components through behavior visible to users, while Supertest sends HTTP requests to an application for API assertions. They can be combined, but none automatically chooses meaningful cases or guarantees realism.
Test doubles replace real collaborators so a test can control conditions or observe interactions. A stub supplies a response, a spy records calls, and a mock often combines replacement with expected interactions; terminology varies by library. Fixtures supply stable input data so cases are repeatable.
Coverage measures which lines, branches or functions executed while tests ran. It can reveal untested areas, but execution does not prove that the assertions checked correct behavior. A suite can reach every line and still miss invalid inputs, race conditions or a wrong expected value.
Modules1
Testing learning module