[Pkg-javascript-commits] [node-mocks-http] 205/296: feat(lib): add mockExpress()

Thorsten Alteholz alteholz at moszumanska.debian.org
Mon Feb 8 18:13:37 UTC 2016


This is an automated email from the git hooks/post-receive script.

alteholz pushed a commit to branch master
in repository node-mocks-http.

commit 8e856e5bf6b2096d938ac892e073e5095b463c94
Author: Johnny Estilles <johnny.estilles at agentia.asia>
Date:   Sat Apr 18 18:41:23 2015 +0800

    feat(lib): add mockExpress()
---
 lib/mock-express.js | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/lib/mock-express.js b/lib/mock-express.js
new file mode 100644
index 0000000..0741dfb
--- /dev/null
+++ b/lib/mock-express.js
@@ -0,0 +1,33 @@
+'use strict';
+
+var EventEmitter = require('events').EventEmitter;
+
+var mixin = require('merge-descriptors');
+
+var application = require('./mockApplication');
+var request = require('./mockRequest');
+var response = require('./mockResponse');
+
+exports = module.exports = createApplication;
+
+function createApplication() {
+  var app = function() {};
+
+  mixin(app, EventEmitter.prototype, false);
+  mixin(app, application, false);
+
+  app.request = {
+    __proto__: request,
+    app: app
+  };
+  app.response = {
+    __proto__: response,
+    app: app
+  };
+  app.init();
+  return app;
+}
+
+exports.application = application;
+exports.request = request;
+exports.response = response;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-mocks-http.git



More information about the Pkg-javascript-commits mailing list