Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start of tests for json marshalling of resources
ktoso kind of shamed me with his extensive resource tests in #49 :), so I'm finally starting to setup a structure for more general testing of this type. This change adds the `testJSONMarshal` helper function, and adds tests for the `User` type. This includes two checks: - check that an empty resource produces an empty JSON object. This effectively verifies that all fields include 'omitempty' so that we're not unintentionally sending additional data over the wire. - check that a full resource with every field populated produces the expected JSON. This verifies that the JSON field mappings are correct. In this case, it might be okay to use resource samples from the GitHub docs, though I do still prefer very simple field values since it makes tests easier to read. When these tests are added for each resource type, we can reduce all of our other tests to return bare minimal response bodies, since the resource fields are already being tested at that point.
- Loading branch information
5f1c20a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That commit message humbles me deeply ;-)
I like the idea, it'll make the actual API tests smaller, +1 :-)