Test allow & deny for collection


#1

Hi all,

Once we have defined our rules with allow/deny, is there a way to later test them against a specific item to see if the write or update will be allowed?


#2

You could always test by hand with the chrome console, but a “real” solution would be to set up a testing framework like Jasmine so that you can automate it.

Within a test file you could call insert/update with fake data, and assert that the observed response is correct. Check out that Jasmine package for examples.


#3

I used jasmine to test my allow/deny rules for discover meteor’s allow/deny challenge. You can use my testing code as a template for your tests. I posed them on github: https://github.com/ifell/Chatroom-Security-Challenge.

I hope this helps :slight_smile:


#4

Thanks for your answers. Actually a solution is indeed to try to update with fake data and observe the callback.