YUKI Hiroshi
null+****@clear*****
Thu Aug 1 14:26:30 JST 2013
YUKI Hiroshi 2013-08-01 14:26:30 +0900 (Thu, 01 Aug 2013) New Revision: 3fff4b0e592c2f5155d70e3bdcb05e8401f03314 https://github.com/groonga/express-droonga/commit/3fff4b0e592c2f5155d70e3bdcb05e8401f03314 Message: Update tests for the new style of command definitions Modified files: test/adapter/rest.test.js test/adapter/socket.io.test.js Modified: test/adapter/rest.test.js (+6 -2) =================================================================== --- test/adapter/rest.test.js 2013-08-01 14:18:32 +0900 (c65ef7e) +++ test/adapter/rest.test.js 2013-08-01 14:26:30 +0900 (e54f5f1) @@ -76,8 +76,12 @@ suite('HTTP Adapter', function() { var testPlugin = { adapter: new command.HTTPCommand({ path: '/path/to/adapter', - requestConverter: function(event, request) { return [event, 'adapter requested']; }, - responseConverter: function(event, data) { return [event, 'adapter OK']; } + onRequest: function(request, connection) { + connection.emit('adapter', 'adapter requested'); + }, + onResponse: function(data, response) { + response.jsonp('adapter OK', 200); + } }) }; Modified: test/adapter/socket.io.test.js (+24 -8) =================================================================== --- test/adapter/socket.io.test.js 2013-08-01 14:18:32 +0900 (8bd3f2d) +++ test/adapter/socket.io.test.js 2013-08-01 14:26:30 +0900 (ce46734) @@ -18,21 +18,37 @@ suite('Socket.IO Adapter', function() { var testPlugin = { 'reqrep': new command.SocketRequestResponse(), 'reqrep-mod-event': new command.SocketRequestResponse({ - requestConverter: function(event, data) { return [event + '.mod', data]; }, - responseConverter: function(event, data) { return [event + '.mod', data]; } + onRequest: function(data, connection) { + connection.emit('reqrep-mod-event.mod', data); + }, + onResponse: function(data, socket) { + socket.emit('reqrep-mod-event.mod', data); + } }), 'reqrep-mod-body': new command.SocketRequestResponse({ - requestConverter: function(event, data) { return [event, 'modified request']; }, - responseConverter: function(event, data) { return [event, 'modified response']; } + onRequest: function(data, connection) { + connection.emit('reqrep-mod-body', 'modified request'); + }, + onResponse: function(data, socket) { + socket.emit('reqrep-mod-body', 'modified response'); + } }), 'pubsub': new command.SocketPublishSubscribe(), 'pubsub-mod-event': new command.SocketPublishSubscribe({ - requestConverter: function(event, data) { return [event + '.mod', data]; }, - responseConverter: function(event, data) { return [event + '.mod', data]; } + onRequest: function(data, connection) { + connection.emit('pubsub-mod-event.mod', data); + }, + onResponse: function(data, socket) { + socket.emit('pubsub-mod-event.mod', data); + } }), 'pubsub-mod-body': new command.SocketPublishSubscribe({ - requestConverter: function(event, data) { return [event, 'modified request']; }, - responseConverter: function(event, data) { return [event, 'modified response']; } + onSubscribe: function(data, connection) { + connection.emit('pubsub-mod-body', 'modified request'); + }, + onPublish: function(data, socket) { + socket.emit('pubsub-mod-body', 'modified response'); + } }) }; -------------- next part -------------- HTML����������������������������... Descargar