Open danielbachhuber opened 8 years ago
Hi Daniel,
Thanks for the input! I read you post but I wasn't sure exactly which pieces we were missing. If you submit a PR I'd be happy to review and merge it into this tutorial code (and I'd learn something new in the process, which is great).
Thanks again, Dan
I read you post but I wasn't sure exactly which pieces we were missing.
More so, I wanted to run the tutorial by you to see:
Yours is the only repo that actually had tests :)
If you submit a PR I'd be happy to review and merge it into this tutorial code (and I'd learn something new in the process, which is great).
I've submitted a PR with a few suggested changes (#2).
Overall, I'd recommend being much more liberal on the tests you're writing for error conditions. Clients will always send your application unexpected or incorrect data. If your endpoints can provide consistent, clear, and expected responses, then the client developer's life will be greatly improved (as they won't have to spend hours trying to debug cryptic errors in an application they don't have access to). If you write one test for a successful request, write 4 or 5 for the permutations of erred requests.
If your endpoints can provide consistent, clear, and expected responses, then the client developer's life will be greatly improved (as they won't have to spend hours trying to debug cryptic errors in an application they don't have access to).
Case in point:
Hi!
On behalf of Pantheon, I'm writing a tutorial on why integration tests are critical for your WP REST API endpoints, and how you can go about writing them.
Given your use of
register_rest_field()
, I think you could benefit from reading and applying the tutorial. And, because the tutorial isn't yet published, I'd very much appreciate any constructive criticism you have, so that we can make the tutorial an evergreen resource for the community.Thanks in advance for your time. Happy to take any questions, comments, etc. you might have in this Github issue, or on the document itself (you'll need to be signed into Dropbox).