Example with testing the count method
// With this test file located in ./test/thistest.js var app = require('../server'); describe('Student node api', function(){ it('counts initially 0 student', function(cb){ app.models.Student.count({}, function(err, count){ assert.deepEqual(count, 0); }); }); });
This way you can test the node API without calling the REST API.
However, for built-in methods, this material has already been verified by force, so for testing the node API this should be useless. But for remote (= user) methods, this may be interesting.
EDIT: The reason this way of doing things is not explained is because in the end you will need to test your full REST API to ensure that not only the node API works as expected, but also correctly configured the ACL. return codes, etc. So, in the end, you end up writing 2 different tests for the same, which is a waste of time. (If you do not want to write tests :)
source share