[Groonga-commit] droonga/express-droonga at 68a80b8 [master] Reduce indent

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Oct 16 16:21:46 JST 2013


YUKI Hiroshi	2013-10-16 16:21:46 +0900 (Wed, 16 Oct 2013)

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

  Message:
    Reduce indent

  Modified files:
    test/adapter/socket.io.test.js

  Modified: test/adapter/socket.io.test.js (+47 -47)
===================================================================
--- test/adapter/socket.io.test.js    2013-10-16 16:20:44 +0900 (7259852)
+++ test/adapter/socket.io.test.js    2013-10-16 16:21:46 +0900 (642b217)
@@ -167,51 +167,51 @@ suite('Socket.IO Adapter', function() {
       });
   });
 
-    function testReqRep(test, description, params) {
-      test(description, function(done) {
-        var mockedReceiver;
-        utils.setupApplication()
-          .next(function(result) {
-            server     = result.server;
-            connection = result.connection;
-            backend    = result.backend;
-            socketIoAdapter.register(result.application, server, {
-              tag:      utils.testTag,
-              connection: connection,
-              plugins: [testPlugin]
-            });
-          })
-          .createClientSocket()
-          .next(function(newClientSocket) {
-            clientSockets.push(newClientSocket);
-            clientSockets[0].emit(params.clientCommand, params.clientBody);
-          })
-          .wait(0.01)
-          .next(function() {
-            backend.assertReceived([{ type: params.expectedClientCommand,
-                                      body: params.expectedClientBody }]);
-
-            mockedReceiver = nodemock
-              .mock('receive')
-                .takes(params.expectedBackendBody);
-            clientSockets[0].on(params.expectedBackendCommand, function(data) {
-              mockedReceiver.receive(data);
-            });
-
-            return backend.sendResponse(backend.getMessages()[0],
-                                        params.backendCommand,
-                                        params.backendBody);
-          })
-          .wait(0.01)
-          .next(function() {
-            mockedReceiver.assertThrows();
-            done();
-          })
-          .error(function(error) {
-            done(error);
+  function testReqRep(test, description, params) {
+    test(description, function(done) {
+      var mockedReceiver;
+      utils.setupApplication()
+        .next(function(result) {
+          server     = result.server;
+          connection = result.connection;
+          backend    = result.backend;
+          socketIoAdapter.register(result.application, server, {
+            tag:      utils.testTag,
+            connection: connection,
+            plugins: [testPlugin]
           });
-      });
-    }
+        })
+        .createClientSocket()
+        .next(function(newClientSocket) {
+          clientSockets.push(newClientSocket);
+          clientSockets[0].emit(params.clientCommand, params.clientBody);
+        })
+        .wait(0.01)
+        .next(function() {
+          backend.assertReceived([{ type: params.expectedClientCommand,
+                                    body: params.expectedClientBody }]);
+
+          mockedReceiver = nodemock
+            .mock('receive')
+              .takes(params.expectedBackendBody);
+          clientSockets[0].on(params.expectedBackendCommand, function(data) {
+            mockedReceiver.receive(data);
+          });
+
+          return backend.sendResponse(backend.getMessages()[0],
+                                      params.backendCommand,
+                                      params.backendBody);
+        })
+        .wait(0.01)
+        .next(function() {
+          mockedReceiver.assertThrows();
+          done();
+        })
+        .error(function(error) {
+          done(error);
+        });
+    });
+  }
 
   suite('request-response', function() {
     testReqRep(test, 'basic', {
@@ -385,7 +385,7 @@ suite('Socket.IO Adapter', function() {
   });
 
   suite('publish-subscribe', function() {
-    test(test, 'basic', {
+    testReqRep(test, 'basic', {
       clientCommand:          'pubsub.subscribe',
       clientBody:             'raw request',
       expectedClientCommand:  'pubsub.subscribe',
@@ -396,7 +396,7 @@ suite('Socket.IO Adapter', function() {
       expectedBackendBody:    'raw response'        
     });
 
-    test(test, 'modified event type', {
+    testReqRep(test, 'modified event type', {
       clientCommand:          'pubsub-mod-event.subscribe',
       clientBody:             'raw request',
       expectedClientCommand:  'pubsub-mod-event.mod.subscribe',
@@ -407,7 +407,7 @@ suite('Socket.IO Adapter', function() {
       expectedBackendBody:    'raw response'        
     });
 
-    test(test, 'modified body', {
+    testReqRep(test, 'modified body', {
       clientCommand:          'pubsub-mod-body.subscribe',
       clientBody:             'raw request',
       expectedClientCommand:  'pubsub-mod-body.subscribe',
-------------- next part --------------
HTML����������������������������...
Download 



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