permanent-waves/node_modules/parse-cache-control/test.js
2024-07-20 14:41:35 -05:00

32 lines
789 B
JavaScript

var test = require('tape');
var parseCacheControl = require('./index');
test('parseCacheControl', function (t) {
var header = parseCacheControl('must-revalidate, max-age=3600');
t.ok(header);
t.equal(header['must-revalidate'], true);
t.equal(header['max-age'], 3600);
header = parseCacheControl('must-revalidate, max-age="3600"');
t.ok(header);
t.equal(header['must-revalidate'], true);
t.equal(header['max-age'], 3600);
header = parseCacheControl('must-revalidate, b =3600');
t.notOk(header);
header = parseCacheControl('must-revalidate, max-age=a3600');
t.notOk(header);
header = parseCacheControl(123);
t.notOk(header);
header = parseCacheControl(null);
t.notOk(header);
header = parseCacheControl(undefined);
t.notOk(header);
t.end();
});