In this episode, we're fixing up our invitation feature by making sure that only valid email addresses can be used when inviting someone. Previously, we set up some validation rules, but we totally missed actually checking if the email was, well, actually an email address!
So, we go back into our code and add a proper email validation rule. To make sure this works, we hop over to our tests. We already had a test for requiring an email address, but nothing specifically checking if it’s a valid email. So we write a new test, purposely give it a string that’s not an email, and run our tests to see if the validation catches it.
Everything passes, and we talk a bit about how you can and should write these kinds of tests for your other validation rules across the system. Overall, it’s a quick but important episode on tightening things up and making sure our invites don’t go to totally bogus addresses.