UNPKG

806 BJavaScriptView Raw
1'use strict';
2
3const assert = require('assert');
4const CachePolicy = require('..');
5
6
7describe('Other', function() {
8 it('Thaw wrong object', function() {
9 assert.throws(() => {
10 CachePolicy.fromObject({});
11 });
12 });
13
14 it('Missing headers', function() {
15 assert.throws(() => {
16 new CachePolicy({});
17 });
18 assert.throws(() => {
19 new CachePolicy({headers:{}}, {});
20 });
21
22 const cache = new CachePolicy({headers:{}}, {headers:{}});
23 assert.throws(() => {
24 cache.satisfiesWithoutRevalidation({});
25 });
26 assert.throws(() => {
27 cache.revalidatedPolicy({});
28 });
29 assert.throws(() => {
30 cache.revalidatedPolicy({headers:{}}, {});
31 });
32 });
33});