[Groonga-commit] groonga/express-kotoumi [master] test: Define test plugins as models

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Feb 7 17:09:17 JST 2013


YUKI Hiroshi	2013-02-07 17:09:17 +0900 (Thu, 07 Feb 2013)

  New Revision: b28fe2e6c74579b3babde679e964c997c4f1ae7c
  https://github.com/groonga/express-kotoumi/commit/b28fe2e6c74579b3babde679e964c997c4f1ae7c

  Log:
    test: Define test  plugins as models

  Modified files:
    test/express-adaptor.test.js
    test/frontend-rest-adaptor.test.js
    test/frontend-socket.io-adaptor.test.js

  Modified: test/express-adaptor.test.js (+7 -3)
===================================================================
--- test/express-adaptor.test.js    2013-02-07 17:05:02 +0900 (1e77530)
+++ test/express-adaptor.test.js    2013-02-07 17:09:17 +0900 (f8c558a)
@@ -14,12 +14,16 @@ suite('Adaption for express application', function() {
       return {
         method: 'GET',
         path: path,
-        requestBuilder: function() { return command + ' requested'; },
-        responseBuilder: function() { return command + ' OK'; }
+        requestBuilder: function() {},
+        responseBuilder: function() {}
       };
     }
     var testPlugin = {
-      api: defineCommand('api', '/path/to/api')
+      api: new model.REST({
+        path: '/path/to/api',
+        toBackend: function() { return 'api requested'; },
+        toClient: function() { return 'api OK'; }
+      })
     };
 
     var connection;

  Modified: test/frontend-rest-adaptor.test.js (+8 -8)
===================================================================
--- test/frontend-rest-adaptor.test.js    2013-02-07 17:05:02 +0900 (07289e5)
+++ test/frontend-rest-adaptor.test.js    2013-02-07 17:09:17 +0900 (117566b)
@@ -78,17 +78,17 @@ suite('REST API', function() {
 
   suite('registeration', function() {
     var testPlugin = {
-      api: {
+      api: new model.REST({
         path: '/path/to/api',
-        requestBuilder: function() { return 'api requested'; },
-        responseBuilder: function() { return 'api OK'; }
-      },
-      customCommandAPI: {
+        toBackend: function() { return 'api requested'; },
+        toClient: function() { return 'api OK'; }
+      }),
+      customCommandAPI: new model.REST({
         command: 'custom',
         path: '/path/to/customCommandAPI',
-        requestBuilder: function() { return 'customCommandAPI requested'; },
-        responseBuilder: function() { return 'customCommandAPI OK'; }
-      }
+        toBackend: function() { return 'customCommandAPI requested'; },
+        toClient: function() { return 'customCommandAPI OK'; }
+      })
     };
 
     var connection;

  Modified: test/frontend-socket.io-adaptor.test.js (+9 -10)
===================================================================
--- test/frontend-socket.io-adaptor.test.js    2013-02-07 17:05:02 +0900 (83042f9)
+++ test/frontend-socket.io-adaptor.test.js    2013-02-07 17:09:17 +0900 (a504d8f)
@@ -189,16 +189,15 @@ suite('Socket.IO API', function() {
   });
 
   var testPlugin = {
-    'foobar': {
-    },
-    'builder': {
-      requestBuilder: function() { return 'builder request'; },
-      responseBuilder: function() { return 'builder response' }
-    },
-    'customevent': {
-      responseEvent: 'custom',
-      responseBuilder: function() { return 'custom response' }
-    }
+    'foobar': new model.SocketCommand(),
+    'builder': new model.SocketRequestResponse({
+      toBackend: function() { return 'builder request'; },
+      toClient: function() { return 'builder response' }
+    }),
+    'customevent': new model.SocketRequestResponse({
+      toBackend: 'custom',
+      toClient: function() { return 'custom response' }
+    })
   };
 
   test('front to back, extra command (without builder)', function(done) {
-------------- next part --------------
HTML����������������������������...
다운로드 



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