|
|
|
|
|
by Supermancho
1651 days ago
|
|
> How would you test a REST endpoint, if I may ask? Functional test (or integration test if you like). That wasn't the point. > For anything more complex you should be writing a service which can and should be unit tested. You're special casing a function based on how it's placed in the flow of the project. Unit (fn being a unit) tests are necessarily agnostic as to the overall functionality. If you want to special case how you are handling functions in a project, good luck. You'll continue to have failures that you'll handwave away as "not following the patterns" or "simple mistakes" rather than recognizing that you should have had useful unit tests to prevent it. People often conflate the reasons that unit testing doesn't prevent bugs.
The primary weakness of unit testing is that you cannot assert "no additional functionality" in the function implementation (code). When languages adopt testing as a first class concern and provide function hashes as a validation, we will see it adopted en-mass and these runtime compositions strategies will be left out, and rightly so. |
|