YUKI Hiroshi
null+****@clear*****
Fri Oct 17 18:00:34 JST 2014
YUKI Hiroshi 2014-10-17 18:00:34 +0900 (Fri, 17 Oct 2014) New Revision: 6a3aabbbc5ad10c69a9ba4f4b19590ec434d0450 https://github.com/droonga/express-droonga/commit/6a3aabbbc5ad10c69a9ba4f4b19590ec434d0450 Message: Execute given callback stubbed connections (to simulate returned responses) Modified files: test/test-utils.js Modified: test/test-utils.js (+18 -6) =================================================================== --- test/test-utils.js 2014-10-17 17:59:55 +0900 (1b4fc46) +++ test/test-utils.js 2014-10-17 18:00:34 +0900 (3b2b181) @@ -202,12 +202,24 @@ function createStubbedBackendConnection(hostName) { tag: testTag, emitMessage: function(type, message, callback, options) { - this.emitMessageCalledArguments.push({ - type: type, - message: message, - callback: callback, - options: options - }); + if (typeof callback != 'function') { + callback = null; + options = callback; + } + + var args = { + type: type, + message: message + }; + if (callback) + args.callback = callback; + if (Object.keys(options).length > 0) + args.options = options; + + this.emitMessageCalledArguments.push(args); + + if (typeof callback == 'function') + callback(null, { type: type + '.result', message: {} }); }, emitMessageCalledArguments: [], getRouteToSelf: function() { -------------- next part -------------- HTML����������������������������...Descargar