code: function wrap(factory) {
    var out = {};
  
    methods.forEach(function (method) {
      out[method] = function () {
        var test = factory[method].apply(factory, arguments);
        test.then = createPromiseMethod("then");
        test.catch = createPromiseMethod("catch");
        return test;
      };
    });
  
    return out;
  }
docs: Creates a new object that wraps `factory`, where each HTTP method (`get`, `post`, etc.) is overriden to inject a `then` method into the returned `Test` instance.