[Groonga-commit] droonga/express-droonga at 87a1e40 [master] Update test for Connection#emit() with callback

アーカイブの一覧に戻る

YUKI Hiroshi null+****@clear*****
Wed Oct 16 15:57:13 JST 2013


YUKI Hiroshi	2013-10-16 15:57:13 +0900 (Wed, 16 Oct 2013)

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

  Message:
    Update test for Connection#emit() with callback

  Modified files:
    test/droonga-protocol/connection.test.js
    test/test-utils.js

  Modified: test/droonga-protocol/connection.test.js (+6 -3)
===================================================================
--- test/droonga-protocol/connection.test.js    2013-10-16 15:31:26 +0900 (1f94175)
+++ test/droonga-protocol/connection.test.js    2013-10-16 15:57:13 +0900 (6eae859)
@@ -111,21 +111,24 @@ suite('Connection', function() {
 
     suite('one way message', function() {
       test('from front to back', function(done) {
-        var objectMessage = connection.emitMessage('object', { command: 'foobar' });
+        var callback = function() {};
+
+        var objectMessage = connection.emitMessage('object', { command: 'foobar' }, callback);
         assert.envelopeEqual(objectMessage,
                              utils.createExpectedEnvelope('object',
                                                           { command: 'foobar' }));
 
-        var stringMessage = connection.emitMessage('string', 'string');
+        var stringMessage = connection.emitMessage('string', 'string', callback);
         assert.envelopeEqual(stringMessage,
                              utils.createExpectedEnvelope('string', 'string'));
 
-        var numericMessage = connection.emitMessage('numeric', 1234);
+        var numericMessage = connection.emitMessage('numeric', 1234, callback);
         assert.envelopeEqual(numericMessage,
                              utils.createExpectedEnvelope('numeric', 1234));
 
         var messageForAnotherDataset = connection.emitMessage('message',
                                                               'another',
+                                                              callback,
                                                               { dataset: 'another' });
         assert.envelopeEqual(messageForAnotherDataset,
                              utils.createExpectedEnvelope('message',

  Modified: test/test-utils.js (+3 -1)
===================================================================
--- test/test-utils.js    2013-10-16 15:31:26 +0900 (121bd92)
+++ test/test-utils.js    2013-10-16 15:57:13 +0900 (25584c7)
@@ -313,11 +313,13 @@ function createEnvelope(type, body, options) {
 }
 exports.createEnvelope = createEnvelope;
 
-function createExpectedEnvelope(type, body) {
+function createExpectedEnvelope(type, body, options) {
   var envelope = createEnvelope(type, body);
   envelope.replyTo = new RegExp('^' + envelope.replyTo + '\\?connection_id=\\d+$');
   envelope.id = TypeOf('string');
   envelope.date = InstanceOf(Date);
+  if (options && options.dataset)
+    envelope.dataset = options.dataset;
   return envelope;
 }
 exports.createExpectedEnvelope = createExpectedEnvelope;
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る