[Groonga-commit] groonga/express-kotoumi [master] Add test for backend-adaptor

Zurück zum Archiv-Index

YUKI Hiroshi null+****@clear*****
Fri Dec 28 17:54:09 JST 2012


YUKI Hiroshi	2012-12-28 17:54:09 +0900 (Fri, 28 Dec 2012)

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

  Log:
    Add test for backend-adaptor

  Added files:
    test/backend-adaptor.test.js

  Added: test/backend-adaptor.test.js (+37 -0) 100644
===================================================================
--- /dev/null
+++ test/backend-adaptor.test.js    2012-12-28 17:54:09 +0900 (62d2b4a)
@@ -0,0 +1,37 @@
+var assert = require('chai').assert;
+var nodemock = require('nodemock');
+
+var Connection = require('../lib/backend-adaptor').Connection;
+
+suit('Connection', function() {
+  var connection;
+  var sender;
+
+  setup(function() {
+    sender = {
+      emittedMessages: [];
+      emit: function(tag, message) {
+        this.emittedMessages.push({ tag: tag, message: message });
+      }
+    };
+    connection = new Connection({
+      tag: 'test',
+      host: 'localhost',
+      port: 3000,
+      sender: sender
+    });
+  });
+
+  teardown(function() {
+    connection = undefined;
+    sender = undefined;
+  });
+
+  test('message without response (volatile message)', function() {
+    connection.emit({ command: 'foobar' });
+    assert.deepEqual(sender.emittedMessages,
+                     [{ tag: 'message',
+                        message: { command: 'foobar' } }]);
+  });
+});
+
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index