Skip to content

Commit

Permalink
Add more tests for Rule
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Mar 20, 2014
1 parent c89612d commit d63e1c3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/response-cache/rule.test.js
Expand Up @@ -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' }));
});
});
});

0 comments on commit d63e1c3

Please sign in to comment.