Jasmine throws minimongo error on Meteor

75 Views Asked by At

My code goes here (in coffeescript):

describe "Chat", ->
  it "should contain 1 message after insert()", ->
    collection = new Meteor.Collection(null)
    collection.insert({username:'guest', message : 'hi'})
    expect(collection.find({}).count()).not.toBe(0 )

When runs in Meteor, it complains:

Error: TypeError: Cannot read property '_docs' of undefined at [object Object].LocalCollection.Cursor._getRawObjects (/Users/user/WebstormProjects/mud-craft/.meteor/local/build/programs/server/packages/minimongo.js:512:18) at [object Object].LocalCollection.Cursor.count (/Users/user/WebstormProjects/mud-craft/.meteor/local/build/programs/server/packages/minimongo.js:260:15) at Object.<anonymous> (/Users/user/WebstormProjects/mud-craft/tests/jasmine/server/unit/sample_server_test.coffee:6:5)

But it's ok in product code.

0

There are 0 best solutions below