You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
636 B
29 lines
636 B
import test from 'ava';
|
|
import tk from 'timekeeper';
|
|
import isEqual from 'date-fns/is_equal';
|
|
import expired from '../';
|
|
|
|
test('headers can be passed in as an object', t => {
|
|
const date = new Date().toUTCString();
|
|
const headers = {
|
|
date: date,
|
|
age: 0,
|
|
'cache-control': `public, max-age=0`
|
|
};
|
|
|
|
tk.freeze(date);
|
|
t.true(isEqual(expired.on(headers), date));
|
|
tk.reset();
|
|
});
|
|
|
|
test('headers can be passed in as a string', t => {
|
|
const date = new Date().toUTCString();
|
|
const headers = `
|
|
Date: ${date}
|
|
Age: 0
|
|
Cache-Control public, max-age=0`;
|
|
|
|
tk.freeze(date);
|
|
t.true(isEqual(expired.on(headers), date));
|
|
tk.reset();
|
|
});
|
|
|