I've updated my allow and deny rules from the client. No inserts, updates or removes should work on the client side. Previously this test (listed below) passed because it tested to see if the client could insert into the collection. Now I want to switch this to test make sure the test only passes when the client can't insert into the collection.
How is this done?
//tests/tests.js
var assert = require('assert');
suite('Donate', function() {
test('in the server', function(done, server) {
server.eval(function() {
Donate.insert({fname: 'George'});
var docs = Donate.find().fetch();
emit('docs', docs);
});
server.once('docs', function(docs) {
assert.equal(docs.length, 1);
done();
});
});
});
test('using both client and the server', function(done, server, client) {
server.eval(function() {
Donate.find().observe({
added: addedNewDonate
});
function addedNewDonate(donate) {
emit('donate', donate);
}
}).once('donate', function(donate) {
assert.equal(donate.fname, 'George');
done();
});
client.eval(function() {
Donate.insert({fname: 'George'});
});
});