[Groonga-commit] droonga/express-droonga at cb2fdf7 [master] Assert responses from multiple backends

Back to archive index

YUKI Hiroshi null+****@clear*****
Fri Oct 17 18:17:26 JST 2014


YUKI Hiroshi	2014-10-17 18:17:26 +0900 (Fri, 17 Oct 2014)

  New Revision: cb2fdf735011a8e5595545fa59ab157dc29ae324
  https://github.com/droonga/express-droonga/commit/cb2fdf735011a8e5595545fa59ab157dc29ae324

  Message:
    Assert responses from multiple backends

  Modified files:
    test/adapter/http.test.js

  Modified: test/adapter/http.test.js (+15 -1)
===================================================================
--- test/adapter/http.test.js    2014-10-17 18:17:00 +0900 (fb7e432)
+++ test/adapter/http.test.js    2014-10-17 18:17:26 +0900 (bcac847)
@@ -249,7 +249,7 @@ suite('HTTP Adapter', function() {
           connection.emit('adapter', 'requested ' + request.query.id);
         },
         onResponse: function(data, response) {
-          response.status(200).jsonp('OK');
+          response.status(200).send(data);
         }
       })
     };
@@ -274,14 +274,19 @@ suite('HTTP Adapter', function() {
           testPlugin
         ]
       });
+      var responses = [];
       utils.setupServer(application)
         .then(function(newServer) {
           server = newServer;
         })
         .then(utils.getCb('/endpoint?id=1'))
+          .then(function(response) { responses.push(response); })
         .then(utils.getCb('/endpoint?id=2'))
+          .then(function(response) { responses.push(response); })
         .then(utils.getCb('/endpoint?id=3'))
+          .then(function(response) { responses.push(response); })
         .then(utils.getCb('/endpoint?id=4'))
+          .then(function(response) { responses.push(response); })
         .then(function() {
           assert.deepEqual(
             connections.connections.map(function(connection) {
@@ -299,6 +304,15 @@ suite('HTTP Adapter', function() {
               [{ type: 'adapter', message: 'requested 3' }]
             ]
           );
+          assert.deepEqual(
+            responses,
+            [
+              { statusCode: 200, body: 'requested 1' },
+              { statusCode: 200, body: 'requested 2' },
+              { statusCode: 200, body: 'requested 3' },
+              { statusCode: 200, body: 'requested 4' }
+            ]
+          );
           done();
         })
         .catch(done);
-------------- next part --------------
HTML����������������������������...
Download 



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