无法弄清楚为什么摩卡测试通过

Can't figure out why mocha test is passing

我正在 javascript 学习测试,我有这个 mocha 测试 运行ning

describe("Fetches Coordinates", function() {
        it("searches the database for coordinates", function() {
            var boundary = routes.setBoundries(20, 80, 20, 80)
            routes.searchCoords(boundary, function(err,data) {
                expect(data.length).to.equal(100)
            });
        });
    });

这是它正在使用的方法

exports.searchCoords = function searchCoords(boundary, callback){
     models.sequelize.query('SELECT "data".longitude, "data".latitude, "data".ipscount FROM ('
                + ' SELECT * FROM "DataPoints" as "data"'
                + ' WHERE "data".longitude BETWEEN '
                + boundary.xlowerbound + ' and ' + boundary.xupperbound + ') data'
                + ' WHERE "data".latitude BETWEEN '
                + boundary.ylowerbound + ' and '
                + boundary.yupperbound + ';', { type: models.sequelize.QueryTypes.SELECT}).then(function(data) {
                    callback(data);
                });                 
}

当我 运行 测试时,Mocha 似乎只是跳过回调并通过。我似乎无法理解这一点。正确的语法是什么?

Testing asynchronous code with Mocha could not be simpler! Simply invoke the callback when your test is complete. By adding a callback (usually named done) to it() Mocha will know that it should wait for completion.

   it("searches the database for coordinates", function(done) {
        var boundary = routes.setBoundries(20, 80, 20, 80)
        routes.searchCoords(boundary, function(err,data) {
            expect(data.length).to.equal(100)
            done();
        });
    });