Unit Testing Express Middleware That Verifies Auth Tokens
I only looked at the tests briefly, but they look good and I like your approach

The following changes will help the readability of your main code:


Prefer early returning guard clauses over if/else.  It's easier to follow, uses less code, and avoids a level of indentation.
Name concepts clearly and move them to helper functions, so that your main body expresses its intent better: see notAuthorized()
Arguably a personal preference, but consider it: For short, one-line if statements, don't use brackets and put them on a single line.


Rewrite (note this hasn't been tested, so it's possible there are trivial errors):

module.exports = {
  ensureAuthenticated: function(req, res) {
    return new Promise(function(resolve, reject) {

      // Use guard clause rather if / else
      const token = req.query.token;
      if (!token) return notAuthorized();

      jwt.verify(token, "secret", function(err, decoded) {

        if (err) return notAuthorized();
        req.user = decoded;
        resolve();
      });

    });
    function notAuthorized() { return reject({ status: 401}) }
  }
};