summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/varytest.js
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2018-04-20 18:26:37 -0700
committerRebecca Turner <me@re-becca.org>2018-05-24 23:24:45 -0700
commit468ab4519e1b92473acefb22801497a1af6aebae (patch)
treebdac1d062cd4b094bde3a21147bab5d82c792ece /deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/varytest.js
parentac8226115e2192a7a46ba07789fa5136f74223e1 (diff)
downloadandroid-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.gz
android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.tar.bz2
android-node-v8-468ab4519e1b92473acefb22801497a1af6aebae.zip
deps: upgrade npm to 6.1.0
PR-URL: https://github.com/nodejs/node/pull/20190 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/varytest.js')
-rw-r--r--deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/varytest.js75
1 files changed, 0 insertions, 75 deletions
diff --git a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/varytest.js b/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/varytest.js
deleted file mode 100644
index 9d5cfb2325..0000000000
--- a/deps/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/http-cache-semantics/test/varytest.js
+++ /dev/null
@@ -1,75 +0,0 @@
-'use strict';
-
-const assert = require('assert');
-const CachePolicy = require('..');
-
-describe('Vary', function() {
- it('Basic', function() {
- const policy = new CachePolicy({headers:{'weather': 'nice'}}, {headers:{'cache-control':'max-age=5','vary':'weather'}});
-
- assert(policy.satisfiesWithoutRevalidation({headers:{'weather': 'nice'}}));
- assert(!policy.satisfiesWithoutRevalidation({headers:{'weather': 'bad'}}));
- });
-
- it("* doesn't match", function() {
- const policy = new CachePolicy({headers:{'weather': 'ok'}}, {headers:{'cache-control':'max-age=5','vary':'*'}});
-
- assert(!policy.satisfiesWithoutRevalidation({headers:{'weather': 'ok'}}));
- });
-
- it("* is stale", function() {
- const policy1 = new CachePolicy({headers:{'weather': 'ok'}}, {headers:{'cache-control':'public,max-age=99', 'vary':'*'}});
- const policy2 = new CachePolicy({headers:{'weather': 'ok'}}, {headers:{'cache-control':'public,max-age=99', 'vary':'weather'}});
-
- assert(policy1.stale());
- assert(!policy2.stale());
- });
-
- it('Values are case-sensitive', function() {
- const policy = new CachePolicy({headers:{'weather': 'BAD'}}, {headers:{'cache-control':'max-age=5','vary':'Weather'}});
-
- assert(policy.satisfiesWithoutRevalidation({headers:{'weather': 'BAD'}}));
- assert(!policy.satisfiesWithoutRevalidation({headers:{'weather': 'bad'}}));
- });
-
- it('Irrelevant headers ignored', function() {
- const policy = new CachePolicy({headers:{'weather': 'nice'}}, {headers:{'cache-control':'max-age=5','vary':'moon-phase'}});
-
- assert(policy.satisfiesWithoutRevalidation({headers:{'weather': 'bad'}}));
- assert(policy.satisfiesWithoutRevalidation({headers:{'sun': 'shining'}}));
- assert(!policy.satisfiesWithoutRevalidation({headers:{'moon-phase': 'full'}}));
- });
-
- it('Absence is meaningful', function() {
- const policy = new CachePolicy({headers:{'weather': 'nice'}}, {headers:{'cache-control':'max-age=5','vary':'moon-phase, weather'}});
-
- assert(policy.satisfiesWithoutRevalidation({headers:{'weather': 'nice'}}));
- assert(!policy.satisfiesWithoutRevalidation({headers:{'weather': 'nice', 'moon-phase': ''}}));
- assert(!policy.satisfiesWithoutRevalidation({headers:{}}));
- });
-
- it('All values must match', function() {
- const policy = new CachePolicy({headers:{'sun': 'shining', 'weather': 'nice'}}, {headers:{'cache-control':'max-age=5','vary':'weather, sun'}});
-
- assert(policy.satisfiesWithoutRevalidation({headers:{'sun': 'shining', 'weather': 'nice'}}));
- assert(!policy.satisfiesWithoutRevalidation({headers:{'sun': 'shining', 'weather': 'bad'}}));
- });
-
- it('Whitespace is OK', function() {
- const policy = new CachePolicy({headers:{'sun': 'shining', 'weather': 'nice'}}, {headers:{'cache-control':'max-age=5','vary':' weather , sun '}});
-
- assert(policy.satisfiesWithoutRevalidation({headers:{'sun': 'shining', 'weather': 'nice'}}));
- assert(!policy.satisfiesWithoutRevalidation({headers:{'weather': 'nice'}}));
- assert(!policy.satisfiesWithoutRevalidation({headers:{'sun': 'shining'}}));
- });
-
- it('Order is irrelevant', function() {
- const policy1 = new CachePolicy({headers:{'sun': 'shining', 'weather': 'nice'}}, {headers:{'cache-control':'max-age=5','vary':'weather, sun'}});
- const policy2 = new CachePolicy({headers:{'sun': 'shining', 'weather': 'nice'}}, {headers:{'cache-control':'max-age=5','vary':'sun, weather'}});
-
- assert(policy1.satisfiesWithoutRevalidation({headers:{'weather': 'nice', 'sun': 'shining'}}));
- assert(policy1.satisfiesWithoutRevalidation({headers:{'sun': 'shining', 'weather': 'nice'}}));
- assert(policy2.satisfiesWithoutRevalidation({headers:{'weather': 'nice', 'sun': 'shining'}}));
- assert(policy2.satisfiesWithoutRevalidation({headers:{'sun': 'shining', 'weather': 'nice'}}));
- });
-});