[Groonga-commit] groonga/express-kotoumi [master] test: Fix wrong usage of Connection#emitMessage:

Back to archive index

YUKI Hiroshi null+****@clear*****
Tue Jan 29 17:26:52 JST 2013


YUKI Hiroshi	2013-01-29 17:26:52 +0900 (Tue, 29 Jan 2013)

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

  Log:
    test: Fix wrong usage of Connection#emitMessage:
    
    It must be called with message type as the first argument

  Modified files:
    test/backend-connection.test.js

  Modified: test/backend-connection.test.js (+13 -3)
===================================================================
--- test/backend-connection.test.js    2013-01-29 17:25:44 +0900 (84a98ee)
+++ test/backend-connection.test.js    2013-01-29 17:26:52 +0900 (69d38b8)
@@ -443,10 +443,11 @@ suite('Connection, to backend', function() {
   });
 
   test('disconnected suddenly', function(done) {
+    var restartedBackend;
     Deferred
       .wait(0.01)
       .next(function() {
-        connection.emitMessage({ message: true });
+        connection.emitMessage('test', { message: true });
       })
       .wait(0.01)
       .next(function() {
@@ -454,11 +455,20 @@ suite('Connection, to backend', function() {
         assert.equal(backend.received[0][0], 'test.message');
 
         backend.close();
-        connection.emitMessage({ message: true });
       })
       .wait(0.01)
       .next(function() {
-        assert.equal(backend.received.length, 1);
+        return createBackend();
+      })
+      .next(function(newBackend) {
+        restartedBackend = newBackend;
+        connection.emitMessage('test', { message: true });
+      })
+      .wait(0.5)
+      .next(function() {
+        assert.equal(restartedBackend.received.length,
+                     1,
+                     'message should be sent to the restarted backend');
         done();
       })
       .error(function(error) {
-------------- next part --------------
HTML����������������������������...
下載 



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