dimanche 28 juin 2015

Testing: Collection.find() is undefined in server side test

I cannot use Collection.find() to retrieve the collection in the server side test.

I am testing a function that inserts a document into a collection. And I would like to test that after calling it, the count() of the collection is 1.

Here is my test using Jasmine:

describe("myFunction", function() {
  it("saves the item", function() {
    // call the function ...

    expect(myCollection.find().count()).toBe(1);
  });
});

But I keep on getting:

TypeError: Cannot call method 'count' of undefined

Any suggestions?

Aucun commentaire:

Enregistrer un commentaire