The code must run all the tests.
This makes refactoring safe. This is one of the most important things, as it allows future people to come in and alter or expand the code safely. One of the most common sources of bugs in codebases that aren’t covered by tests is to have a new feature unintentionally break existing functions.
The tests communicate the design. When the tests are written well, they lay out the plan of what code will be necessary to implement the feature.
The tests describe the desired behavior. Tests shouldn’t simply prove that a function does what it is supposed to do. They should be worded in such a way as to tell the reader what the desired behavior is.
The tests tell you when you are done. Don’t write code that isn’t needed to satisfy the tests. Don’t write code in anticipation of features that haven’t been requested. You aren’t going to need it (YAGNI).