[Groonga-commit] groonga/express-kotoumi [master] test: Complete test about "connection" event on the application

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Feb 4 12:32:50 JST 2013


YUKI Hiroshi	2013-02-04 12:32:50 +0900 (Mon, 04 Feb 2013)

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

  Log:
    test: Complete test about "connection" event on the application

  Modified files:
    test/frontend-socket.io-handler.test.js

  Modified: test/frontend-socket.io-handler.test.js (+22 -4)
===================================================================
--- test/frontend-socket.io-handler.test.js    2013-02-04 12:32:12 +0900 (bca6143)
+++ test/frontend-socket.io-handler.test.js    2013-02-04 12:32:50 +0900 (e3c317f)
@@ -28,17 +28,35 @@ suite('Socket.IO API', function() {
     }
   });
 
-  test('initialization', function() {
+  test('initialization', function(done) {
     var mockedListener = nodemock
-      .mock('connected')
-        .takes({});
+      .mock('connected');
 
     var application = express();
     application.on('connection', function(socket) {
       mockedListener.connected();
     });
+
     utils.setupServer(application)
-    
+      .next(function(newServer) {
+        server = newServer;
+        socketIoHandler.register(application, server, {
+          connection: utils.createStubbedBackendConnection()
+        });
+
+        return utils.createClientSocket();
+      })
+      .next(function(newClientSocket) {
+        clientSocket = newClientSocket;
+      })
+      .wait(0.01)
+      .next(function() {
+        mockedListener.assertThrows();
+        done();
+      })
+      .error(function(error) {
+        done(error);
+      });
   });
 
   test('front to back', function(done) {
-------------- next part --------------
HTML����������������������������...
Download 



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