Browse Source

Keep XO happy

pull/13/head
Luke Childs 8 years ago
parent
commit
c653b408da
  1. 4
      test/expired.in.js
  2. 12
      test/expired.on.js
  3. 2
      test/headers.js

4
test/expired.in.js

@ -11,7 +11,7 @@ test('expired.in returns positive ms for valid cache', t => {
const date = new Date().toUTCString(); const date = new Date().toUTCString();
const maxAge = 300; const maxAge = 300;
const headers = { const headers = {
date: date, date,
age: 0, age: 0,
'cache-control': `public, max-age=${maxAge}` 'cache-control': `public, max-age=${maxAge}`
}; };
@ -25,7 +25,7 @@ test('expired.in returns positive ms for valid cache', t => {
test('expired.in returns zero ms for instantly stale cache', t => { test('expired.in returns zero ms for instantly stale cache', t => {
const date = new Date().toUTCString(); const date = new Date().toUTCString();
const headers = { const headers = {
date: date, date,
age: 0, age: 0,
'cache-control': `public, max-age=0` 'cache-control': `public, max-age=0`
}; };

12
test/expired.on.js

@ -11,7 +11,7 @@ test('expired.on returns correct expirey date for valid cache', t => {
const date = new Date().toUTCString(); const date = new Date().toUTCString();
const maxAge = 300; const maxAge = 300;
const headers = { const headers = {
date: date, date,
age: 0, age: 0,
'cache-control': `public, max-age=${maxAge}` 'cache-control': `public, max-age=${maxAge}`
}; };
@ -23,7 +23,7 @@ test('expired.on returns correct expirey date for valid cache', t => {
test('expired.on returns correct expirey date for instantly stale cache', t => { test('expired.on returns correct expirey date for instantly stale cache', t => {
const date = new Date().toUTCString(); const date = new Date().toUTCString();
const headers = { const headers = {
date: date, date,
age: 0, age: 0,
'cache-control': `public, max-age=0` 'cache-control': `public, max-age=0`
}; };
@ -50,8 +50,8 @@ test('expired.on takes age into account', t => {
const age = 150; const age = 150;
const maxAge = 300; const maxAge = 300;
const headers = { const headers = {
date: date, date,
age: age, age,
'cache-control': `public, max-age=${maxAge}` 'cache-control': `public, max-age=${maxAge}`
}; };
const expiredOn = addSeconds(date, (maxAge - age)); const expiredOn = addSeconds(date, (maxAge - age));
@ -74,8 +74,8 @@ test('expired.on prefers Cache-Control over Expires header', t => {
const age = 150; const age = 150;
const maxAge = 300; const maxAge = 300;
const headers = { const headers = {
date: date, date,
age: age, age,
'cache-control': `public, max-age=${maxAge}`, 'cache-control': `public, max-age=${maxAge}`,
expires: date expires: date
}; };

2
test/headers.js

@ -18,7 +18,7 @@ test('throw error if Date header is missing', t => {
test('headers can be passed in as an object', t => { test('headers can be passed in as an object', t => {
const date = new Date().toUTCString(); const date = new Date().toUTCString();
const headers = { const headers = {
date: date, date,
age: 0, age: 0,
'cache-control': `public, max-age=0` 'cache-control': `public, max-age=0`
}; };

Loading…
Cancel
Save