Integration Test
ELI5 — The Vibe Check
If a unit test checks one LEGO brick, an integration test checks that two bricks actually snap together correctly. You test how different parts of your code talk to each other — like making sure your login button actually talks to your database.
Real Talk
Integration tests verify that multiple components or systems work correctly together. Unlike unit tests, they don't mock dependencies — they test real interactions between modules, services, databases, or APIs.
Show Me The Code
test('user can log in and fetch profile', async () => {
const token = await loginUser('test@example.com', 'password');
const profile = await getProfile(token);
expect(profile.email).toBe('test@example.com');
});
When You'll Hear This
"Integration tests caught that the API wasn't returning the right shape." / "Run the integration tests before merging."
Related Terms
End-to-End Test (E2E)
An end-to-end test is like hiring a robot to be a user.
Mock
A mock is a fake version of something your code talks to.
Test Pyramid
The Test Pyramid is a strategy for how many of each test type to have.
Unit Test
A unit test is like checking that one single LEGO brick isn't broken before you use it in your big castle.