[Groonga-commit] droonga/express-droonga at 2fa27cb [master] Add tests for Cache

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Mar 20 16:48:18 JST 2014


YUKI Hiroshi	2014-03-20 16:48:18 +0900 (Thu, 20 Mar 2014)

  New Revision: 2fa27cbd345ff61ee6ddf424a465d1cbd574acfe
  https://github.com/droonga/express-droonga/commit/2fa27cbd345ff61ee6ddf424a465d1cbd574acfe

  Message:
    Add tests for Cache

  Modified files:
    test/response-cache/cache.test.js

  Modified: test/response-cache/cache.test.js (+29 -0)
===================================================================
--- test/response-cache/cache.test.js    2014-03-20 16:48:04 +0900 (9c0469f)
+++ test/response-cache/cache.test.js    2014-03-20 16:48:18 +0900 (f0e7baf)
@@ -23,5 +23,34 @@ suite('Response Cache', function() {
       }, Error);
     });
   });
+
+  suite('getRule', function() {
+    test('non-GET requests', function() {
+      var cache = new Cache({
+        rules: [
+          { regex: /foo/ }
+        ]
+      });
+      var stubRequest = {
+        method: 'POST'
+      };
+      var rule = cache.getRule(stubRequest);
+      assert.isNull(rule);
+    });
+
+    test('not mached', function() {
+      var cache = new Cache({
+        rules: [
+          { regex: /foo/ }
+        ]
+      });
+      var stubRequest = {
+        method: 'GET',
+        url:    'bar'
+      };
+      var rule = cache.getRule(stubRequest);
+      assert.isNull(rule);
+    });
+  });
 });
 
-------------- next part --------------
HTML����������������������������...
Download 



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