2017-06-23 6 views
0

Ich habe ein Problem in diesem Test. Ich weiß nicht, warum das Einfügen funktioniert, aber wenn ich den Test ausführen ich erhalte:Timeout überschritten Mocha + Sequelize

Error: Timeout of 15000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

CODE

describe('CRUD on Product', function() { 
    this.timeout(15000) 
    it('Insert single Product', function (done) { 
    Product.build({ 
     Customer: customer, 
     Order: order 
    }, { 
     include: [Customer, Order] 
    }).save(function (mind) { 
     console.log(mind) 
     done(); 
    }).catch(function(err){ 
     console.log(err) 
     done() 
    }) 
    }); 
}); 

Antwort

1

Da dies tutorial gezeigt ist, die save Funktion nimmt nicht Rückruf als Parameter. Es gibt eine promise zurück.

describe('CRUD on Product', function() { 
    this.timeout(15000) 
    it('Insert single Product', function (done) { 
    Product.build({ 
     Customer: customer, 
     Order: order 
    }, { 
     include: [Customer, Order] 
    }) 
    .save() 
    .then(function (mind) { 
     console.log(mind) 
     done(); 
    }) 
    .catch(function(err){ 
     console.log(err) 
     done() 
    }) 
    }); 
}); 
Verwandte Themen