Writing Integration Tests
What testing concept does this example illustrate?
test('user authentication flow', async () => {
// 1. Register user
const user = await registerUser(userData);
// 2. Verify email
await verifyEmail(user.verificationToken);
// 3. Login
const { token } = await login(userData);
// 4. Access protected resource
const response = await request(app)
.get('/api/protected')
.set('Authorization', `Bearer ${token}`);
expect(response.status).toBe(200);
});