How we can make unit testing with Parse, in each Cloud Code Function I have multiples query it is difficult to test actually,
How we can make unit test with Parse Query ?
My suggestion is to take a look at how unit testing is done on the parse-server repo itself.
https://github.com/parse-community/parse-server/blob/master/package.json#L75
is the command that runs the tests. Which looks complicated, but basically its just invoking jasmine.
The jasmine config: https://github.com/parse-community/parse-server/blob/master/spec/support/jasmine.json
The helper.js that sets up and tears down the database and the parse-server:
https://github.com/parse-community/parse-server/blob/master/spec/helper.js
the helper has a lot of legacy code in it.
And finally, here's an example of a test of cloud code:
https://github.com/parse-community/parse-server/blob/master/spec/CloudCode.spec.js#L79
There is also this test runner that we wrote:
https://github.com/AmpMe/parse-server-test-runner
It will connect to a local database and you can cleanup data at will.
look at that! nice.
We use it extensively for everything, that's very nice to test e2e cloud functions etc...
Thank you for you answer, I'll take a look at this
Just came across this, very interesting! How would I implement something like the Parse-Server-test-runner?
If I鈥檓 able to grasp it and get it working, I鈥檇 love to contribute to the README or WIKI with instructions for others to use this. I think it鈥檚 super useful!
EDIT: I see there鈥檚 an example in the Repo for the test runner. I鈥檓 not familiar with the language as I write in Swift mostly, but I will play with this and see how far I can get using the example provided.
Open an issue on the test runner if you need an example :)
Most helpful comment
There is also this test runner that we wrote:
https://github.com/AmpMe/parse-server-test-runner
It will connect to a local database and you can cleanup data at will.