summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/misctest.js
blob: 643567d962292753d054419c9261b18d97dca279 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use strict';

const assert = require('assert');
const CachePolicy = require('..');


describe('Other', function() {
    it('Thaw wrong object', function() {
        assert.throws(() => {
            CachePolicy.fromObject({});
        });
    });

    it('Missing headers', function() {
        assert.throws(() => {
            new CachePolicy({});
        });
        assert.throws(() => {
            new CachePolicy({headers:{}}, {});
        });

        const cache = new CachePolicy({headers:{}}, {headers:{}});
        assert.throws(() => {
            cache.satisfiesWithoutRevalidation({});
        });
        assert.throws(() => {
            cache.revalidatedPolicy({});
        });
        assert.throws(() => {
            cache.revalidatedPolicy({headers:{}}, {});
        });
    });
});