[Groonga-commit] groonga/express-droonga at 869fc84 [master] Update tests for the new style of command definitions

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Aug 1 14:18:32 JST 2013


YUKI Hiroshi	2013-08-01 14:18:32 +0900 (Thu, 01 Aug 2013)

  New Revision: 869fc840ea470f915f2d5eedafb2ff50400c41e4
  https://github.com/groonga/express-droonga/commit/869fc840ea470f915f2d5eedafb2ff50400c41e4

  Message:
    Update tests for the new style of command definitions

  Modified files:
    test/express-adapter.test.js

  Modified: test/express-adapter.test.js (+12 -4)
===================================================================
--- test/express-adapter.test.js    2013-08-01 14:00:03 +0900 (7fc9902)
+++ test/express-adapter.test.js    2013-08-01 14:18:32 +0900 (5145324)
@@ -12,14 +12,22 @@ suite('Adaption for express application', function() {
   var testRestPlugin = {
     api: new command.HTTPCommand({
       path: '/path/to/api',
-      requestConverter: function(event, request) { return [event, 'api requested']; },
-      responseConverter: function(event, data) { return [event, 'api OK']; }
+      onRequest: function(request, connection) {
+        connection.emit('api', 'api requested');
+      },
+      onResponse: function(data, response) {
+        response.jsonp('api OK', 200);
+      }
     })
   };
   var testSocketPlugin = {
     api: new command.SocketRequestResponse({
-      requestConverter: function(event, data) { return [event, 'api requested']; },
-      responseConverter: function(event, data) { return [event, 'api OK']; }
+      onRequest: function(data, connection) {
+        connection.emit('api', 'api requested');
+      },
+      onResponse: function(data, socket) {
+        socket.emit('api', 'api OK');
+      }
     })
   };
 
-------------- next part --------------
HTML����������������������������...
下載 



More information about the Groonga-commit mailing list
Back to archive index