Skip to content
tezvyn:

Testing

242 bites tagged Testing — interview questions with model answers, and 60-second explainers.

React & Next.js1 min read

Testing a component that consumes React Context

Render inside the Context.Provider with a value, or omit it to exercise the default; use a custom render wrapper for reuse. Knowing context needs a Provider in tests.

React Native1 min read

Layered testing strategy for a large RN app

Many fast Jest unit tests, fewer RNTL component tests on behavior, few Detox/Maestro E2E on critical flows. understanding the test pyramid in RN.

React Native1 min read

Unit testing a custom hook with renderHook

Render the hook, read result.current, fire actions inside act, assert updated state. knowing how to test hook logic in isolation. calling hook directly outside a component or skipping act around updates.

React Native1 min read

RNTL or Detox for a navigation flow?

RNTL can test navigation logic by rendering the navigator in JS and asserting screen changes; Detox runs the real app for true end-to-end confidence including native transitions. choosing the right test level.

React Native1 min read

What does 'test behavior, not implementation' mean?

Query elements the way a user finds them (text, role, label) and assert observable behavior; for a Button, fire press and assert the visible effect, not internal state. testing philosophy.

React Native1 min read

How do you test a component using a native module?

Native code is absent in the Node-based Jest environment, so you mock the module with jest.mock to return fake values, often via the library's provided jest mock. handling native modules in Jest.

React Native1 min read

How do you mock a fetch call in Jest tests?

Replace global fetch with a Jest mock or a library like jest-fetch-mock, return a resolved Promise with a fake Response, and reset mocks between tests. deterministic network mocking.

React Native1 min read

Unit testing vs component testing in React Native

Unit tests verify isolated functions/logic with Jest; component tests render components and assert behavior with React Native Testing Library. testing taxonomy.

Python & FastAPI1 min read

Testing a DB endpoint via dependency override

Use app.dependency_overrides to swap the real get_db for one yielding a test database session, run against a disposable SQLite or test Postgres, and assert through TestClient. Isolating tests from production data.

Node.js & Express2 min read

Unit testing Express auth middleware in isolation

Build fake req/res, use a spy/mock for next and res methods, assert next called on valid token and 401 sent on invalid. isolating and unit-testing middleware.

Node.js & Express1 min read

Testing an async workflow that spans DB and message queue

Assert the DB row, then verify the queue message via a test consumer or spy, polling with a timeout rather than fixed sleeps. Verifying side effects that finish after the HTTP response.

Node.js & Express1 min read

Testing code that calls a third-party API

Intercept at the HTTP boundary (nock) or run a local mock server; cover success, errors, timeouts, and assert request shape. How you fake external HTTP without real network calls.

Node.js & Express1 min read

Managing clean test state across API integration tests

Compare seed-and-truncate, per-test transaction rollback, and in-memory or containerized databases, weighing fidelity, speed, and isolation. How you keep integration tests isolated and fast.

Node.js & Express1 min read

Testing async Promise-returning code in Jest

Return or await the promise; use await expect(...).resolves/rejects, or await the value directly. Whether you make async assertions actually run before the test ends.

Node.js & Express1 min read

Mocking the database layer in Jest unit tests

A live DB makes tests slow, flaky, and order-dependent; use jest.mock on the model so methods return controlled fakes. Whether you isolate units from slow, stateful dependencies.

Node.js & Express1 min read

Integration testing a POST endpoint with Supertest

Pass the Express app to supertest, send a POST with a body, then assert status 201, the response shape, and the persisted side effect; also test validation failures. HTTP-level integration testing.

Node.js & Express1 min read

Writing a basic Jest unit test

Import the function, group cases with describe, define each case with it or test, assert with expect and a matcher like toBe, covering normal and edge inputs. Jest fundamentals.

Node.js & Express1 min read

Unit, integration, and E2E tests explained

Unit tests isolate one function with dependencies mocked, integration tests exercise several units together (route plus DB), E2E tests drive the whole running system. the test pyramid.

Monitoring & SRE1 min read

How does chaos engineering differ from other testing?

It experiments on real systems by injecting faults to test a steady-state hypothesis, versus verifying known behaviors like integration or load tests. Conceptual grasp of chaos engineering.

Monitoring & SRE1 min read

LitmusChaos

LitmusChaos is an open-source, Kubernetes-native chaos engineering platform that runs fault experiments as custom resources. It injects failures like pod kills, network latency, and resource stress to validate that services stay resilient under real-world…

MLOps & Infrastructure1 min read

Staging Environments for ML Pipelines

A staging environment mirrors production so models and pipelines are validated on production-like data and infrastructure before release. It catches drift, integration breaks, and serving regressions early, making promotion to production a safe, repeatable…

Design Systems1 min read

Bug report to deployed fix workflow

Triage and reproduce, write a failing test, fix it, pass CI gates and review, then patch-release and notify. Whether you have a disciplined bug-fix pipeline.

Design Systems1 min read

Building a visual regression testing pipeline

Snapshot Storybook stories per PR, freeze nondeterminism, set diff thresholds, manage baselines via approvals. scalable visual diffing. pixel-perfect diffs with no flake control or baseline workflow.

Design Systems1 min read

Storybook's role in design system infrastructure

Isolated development, living documentation, visual and interaction testing, shared review surface. why a component explorer matters. describing it only as a dev playground with no testing or docs value.

Get Testing bites daily.

Five a day, five minutes, offline. With quizzes so it sticks.

Open testing — you’ll join as an early tester.