Skip to content

Commit

Permalink
Test expired.in returns zero ms for instantly stale cache
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechilds committed Dec 23, 2016
1 parent 3b6a6d7 commit 2455a21
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/expired.in.js
Expand Up @@ -19,3 +19,16 @@ test('expired.in returns positive ms for valid cache', t => {
t.is(expired.in(headers), maxAge * 1000);
tk.reset();
});

test('expired.in returns zero ms for instantly stale cache', t => {
const date = new Date().toUTCString();
const headers = {
date: date,
age: 0,
'cache-control': `public, max-age=0`
};

tk.freeze(date);
t.is(expired.in(headers), 0);
tk.reset();
});

0 comments on commit 2455a21

Please sign in to comment.