YUKI Hiroshi
null+****@clear*****
Thu Mar 20 16:12:43 JST 2014
YUKI Hiroshi 2014-03-20 16:12:43 +0900 (Thu, 20 Mar 2014) New Revision: d63e1c32d0aa9f9fcc3146b020c2adbcf5a95b1c https://github.com/droonga/express-droonga/commit/d63e1c32d0aa9f9fcc3146b020c2adbcf5a95b1c Message: Add more tests for Rule Modified files: test/response-cache/rule.test.js Modified: test/response-cache/rule.test.js (+18 -0) =================================================================== --- test/response-cache/rule.test.js 2014-03-20 16:08:45 +0900 (ab43468) +++ test/response-cache/rule.test.js 2014-03-20 16:12:43 +0900 (4b2861e) @@ -21,5 +21,23 @@ suite('Response Cache Rule', function() { assert.equal(rule.ttlInMilliSeconds, 20); }); }); + + test('createEntry', function() { + var rule = new Rule({ regex: null, ttlInMilliSeconds: 10 }); + var entry = rule.createEntry(); + assert.equal(entry.ttlInMilliSeconds, 10); + }); + + suite('match', function() { + test('matched', function() { + var rule = new Rule({ regex: /foo/, ttlInMilliSeconds: 10 }); + assert.isTrue(rule.match({ url: 'foo' })); + }); + + test('not matched', function() { + var rule = new Rule({ regex: /foo/, ttlInMilliSeconds: 10 }); + assert.isFalse(rule.match({ url: 'bar' })); + }); + }); }); -------------- next part -------------- HTML����������������������������... Download