I’m new to Mocha velocity and unit testing. I have some problem with my client side test case. When I use find()
command to read from database, it returns 'undefined'
. But it works correctly only at the meteor restart. I used the following code in my client side.
if (!(typeof MochaWeb === 'undefined')){
MochaWeb.testOnly(function(){
describe("TestClient", function(){
it("should give a Refid", function(){
console.log("client test");
var task = tasksCollection.find({"Refid" : 10}).fetch()[0];
console.log(task);
chai.assert.equal(task.Refid, 10);
});
});
});
}
My server side code which I used for the same purpose works properly. Can any one help me to resolve this issue…?