When writing test, you make sure that you write them for someone that is going to be using the code. If it is a backend REST API, you want to make sure you cover all business cases, because that is your user. If you are testing frontend, it should cover the UX as this is your end user and functionality of that UI component, as other developers will use your code too.