javascript - assertEqual error on nodeJs -


i started nodejs development. testing mongodb driver repeatedly getting assertequals has no method.

code sourcerepo

var client = new db('test', new server("127.0.0.1", 27017, {})),     test = function (err, collection) {       collection.insert({a:2}, function(err, docs) {          collection.count(function(err, count) {           test.assertequals(1, count);         });          // locate entries using find         collection.find().toarray(function(err, results) {           test.assertequals(1, results.length);           test.asserttrue(results[0].a === 2);            // let's close db           client.close();         });       });     };  client.open(function(err, p_client) {   client.collection('test_insert', test); }); 

error

has no method 'assertequals'

how reolve it?

you can use node's assert (where called equal rather equal*s*):

var assert = require('assert');  // ... assert.equal(count, 1); // ... 

however, unit tests or similar should consider using testing framework. eg. jasmine node, popular.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -