Add Entity validation via a function in JSONAPITestLib.

This commit is contained in:
Mathew Polzin
2018-11-27 13:33:55 -08:00
parent 3964202ea2
commit aedd5dc29b
10 changed files with 232 additions and 16 deletions
@@ -14,3 +14,11 @@ Please enjoy these examples, but allow me the forced casting and the lack of err
// The JSONAPITestLib provides literal expressibility for key types to
// make creating tests easier
let dog = Dog(id: "1234", attributes: Dog.Attributes(name: "Buddy"), relationships: Dog.Relationships(owner: nil))
// MARK: - JSON API structure checking
// The JSONAPITestLib provides a `check` function for each Entity type
// that uses reflection to catch mistakes that are not forbidden by
// Swift's type system but will result in unexpected results when
// encoding/decoding. It is a good idea to add a `check` to each of
// your unit tests that create Entities.
try Dog.check(dog)