0

When runing the following test I expect to recive

fail AssertionError: expected {} to have key 'key'missing keys: 'key'

but insted I get:

Error: timeout of 5000ms exceeded. Ensure the done() callback is being called in this test.

the test:

describe(__filename,function(){
    beforeEach(function(done){
    App.Test.eraseAndCreateSimulatedDB(done)
    })
    it('get tempUser by id',function(done){
    TempUserDal.getTempUserById(App.Test.tempUser1._id).then(function(tempUser){
        console.log('promise resolved')
        ({}).should.have.keys('key');
        done()
    },function(err){
        done(err)
    })
})

It worth mentioning that I can see "promise resolved" in the console.

Muffasa
  • 218
  • 4
  • 12
  • Yes. Unfortunately asynchronous expectations/tests do not throw as far as I know, they timeout. – Kyll Sep 30 '15 at 16:17
  • 1
    Have you tried to put `done` before assertion? My suggestion is that assertion throws an error and `done` isn't evaluated. In addition try to use next statement in order to write less code :) `TempUserDial.do().then(function(data) { (data).should.have.keys('key'); }).finally(done);` – Evgeniy Sep 30 '15 at 16:27

0 Answers0