Test-driven development (TDD) uses unit tests to drive implementation and design from the inside out, while keeping implementation within architectural boundaries. section 4.2.3
Distinguish TDD from outside-in acceptance testing: acceptance tests verify behavior against acceptance criteria before implementation begins; unit tests then drive design within architectural boundaries. section 4.2.3
Listing 1.3 Test to verify session invalidation after a password reset
test "password reset invalidates all existing sessions for the user"
# Arrange
user = create_user_with_password("old-password")
session_1 = login(user, device="laptop")
session_2 = login(user, device="phone")
session_3 = login(user, device="tablet")
reset_token = request_password_reset(user.email)
# Act
complete_password_reset(reset_token, new_password="new-password")
# Assert
assert session_store.active_sessions_for(user.id) == []A password-reset test arranges three active sessions, completes a reset, and asserts that no sessions remain. section 1.2






















