Browse Source

Test expired.in returns zero ms for instantly stale cache

pull/5/head
Luke Childs 8 years ago
parent
commit
2455a210b4
  1. 13
      test/expired.in.js

13
test/expired.in.js

@ -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();
});

Loading…
Cancel
Save