My goal with this PR is for tests to automatically check if the objects they receive from the API match the interface that is supposed to describe them
For example, if I run yarn test, it would alert me if api.getUser() doesn't give an object that matches UserExtended because it's missing a certain property or because a property isn't the expected type
(this can be the fault of the API or the fault of the package, both are unstable)
I don't think it's possible to check if an object has a property that the interface doesn't have? Kinda sucks if that's the case, but I really cannot complain
But I also want to test that by writing as little as possible, and spend as little time as possible for each test
As of the first commit, this goal hasn't quite been reached, there's definitely work to do
Note that making it so objects and interfaces do match is out of the scope of this PR, it can wait for both this and #26 to be merged
Using ts-json-schema-generator and Ajv JSON schema validator
My goal with this PR is for tests to automatically check if the objects they receive from the API match the interface that is supposed to describe them For example, if I run
yarn test
, it would alert me ifapi.getUser()
doesn't give an object that matchesUserExtended
because it's missing a certain property or because a property isn't the expected type (this can be the fault of the API or the fault of the package, both are unstable)I don't think it's possible to check if an object has a property that the interface doesn't have? Kinda sucks if that's the case, but I really cannot complain
But I also want to test that by writing as little as possible, and spend as little time as possible for each test As of the first commit, this goal hasn't quite been reached, there's definitely work to do
Note that making it so objects and interfaces do match is out of the scope of this PR, it can wait for both this and #26 to be merged