[Groonga-commit] groonga/express-kotoumi [master] test: Use nodemock instead of custom slot

アーカイブの一覧に戻る

YUKI Hiroshi null+****@clear*****
Thu Feb 14 12:19:49 JST 2013


YUKI Hiroshi	2013-02-14 12:19:49 +0900 (Thu, 14 Feb 2013)

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

  Log:
    test: Use nodemock instead of custom slot

  Modified files:
    test/frontend-rest-adaptor.test.js

  Modified: test/frontend-rest-adaptor.test.js (+12 -6)
===================================================================
--- test/frontend-rest-adaptor.test.js    2013-02-14 12:16:43 +0900 (979bef7)
+++ test/frontend-rest-adaptor.test.js    2013-02-14 12:19:49 +0900 (5623854)
@@ -107,10 +107,13 @@ suite('REST API', function() {
         plugins:    [testPlugin]
       });
 
-      var responseBody;
+      var mockedReceiver = nodemock
+            .mock('receive')
+              .takes('api OK');
+
       utils.get('/path/to/api')
         .next(function(response) {
-          responseBody = response.body;
+          mockedReceiver.receive(response.body);
         });
 
       Deferred
@@ -125,7 +128,7 @@ suite('REST API', function() {
         })
         .wait(0.01)
         .next(function() {
-          assert.equal(responseBody, 'api OK');
+          mockedReceiver.assertThrows();
           done();
         })
         .error(function(error) {
@@ -140,10 +143,13 @@ suite('REST API', function() {
         plugins:    [testPlugin]
       });
 
-      var responseBody;
+      var mockedReceiver = nodemock
+            .mock('receive')
+              .takes('api OK');
+
       utils.get('/path/to/kotoumi/path/to/api')
         .next(function(response) {
-          responseBody = response.body;
+          mockedReceiver.receive(response.body);
         });
 
       Deferred
@@ -158,7 +164,7 @@ suite('REST API', function() {
         })
         .wait(0.01)
         .next(function() {
-          assert.equal(responseBody, 'api OK');
+          mockedReceiver.assertThrows();
           done();
         })
         .error(function(error) {
-------------- next part --------------
HTML����������������������������...
ダウンロード 



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