Testing
Testing checks whether software behaves as expected.
What Is Testing
Tests can verify small functions, components, APIs, workflows, integrations, and full user journeys.
They help prevent regressions and make changes safer.
How To Use Testing
Write tests around important behavior, run them automatically, and keep them clear enough to explain what the system should do.
Basic Example
function add(a: number, b: number) {
return a + b;
}
test("adds two numbers", () => {
expect(add(2, 3)).toBe(5);
});
Common Concepts
- Unit tests check small pieces.
- Integration tests check connected pieces.
- End-to-end tests check real user flows.
- Test fixtures set up known data.
What To Learn Next
Learn assertions, mocks, fixtures, test coverage, browser testing, API testing, and continuous integration.