Testing
The collaboration server comes with a testing suite to test your resolvers.
The testing suite will perform a set of reads/write from your database using your resolvers, and inform you if any information is incorrect/missing.
warning
The testing suite reads and writes testing data to/from your database. This may be a destructive operation.
⚠️ Please make sure to run the testing suite against an empty database. ⚠️
#
UsageTo use the test suite, create a node script that imports the testing suite and calls it against your resolvers.
The second parameter should be the getNow function that you also pass into the CollabServer constructor. This parameter is options, but recommended.
Then, execute the script
#
ErrorsThe TestResolvers
function will resolve with an array of error objects. If the array is empty, your resolvers are good to go!
Each error object contains the following information:
resolver
(string) the name of the resolver with an errorqueryParams
(string) a JSON string containing the params that were passed into the resolvererror
(object) information about the errortype
(string) the type of error. One ofdata_type_invalid
,data_missing
,data_invalid
orresolver_missing
property
(string) the name of the property that is invalidexpected
(any) the data that was expectedreceived
(any) the data that was receivedmessage
(string) an error message