In this episode, we’re building out the ability to send friend requests through our app! We start by tidying up a few navigation items so the "Friends" page is easier to access. Then, we jump right into creating a form on the friends page where you can enter someone’s email address to send them a friend request.
Before hooking everything up, we focus on test-driven development by writing a bunch of feature tests for all the crucial behaviors:
We then implement the backend controller logic to get all those green, passing tests, including the necessary validation. Once that's working, we flip back to the UI and make sure that submitting the form actually sends the friend request and updates the pending requests list.
Finally, we make sure error messages from validation show up on the form so it’s clear if something’s missing (like forgetting to type in an email). By the end, we’ve got a workflow where you can enter an email, hit "Send Request", and see your pending friend requests show up—all tested and tidy!
Next up: handling incoming friend requests and actually accepting them!