From 49741e9608f1badb0f6fa2d931dcfb24be6cc8ff Mon Sep 17 00:00:00 2001 From: Randall Schmidt Date: Fri, 27 Nov 2020 22:27:59 -0500 Subject: [PATCH] add test for cache ejection --- test/tests.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/tests.js b/test/tests.js index 588bf62..f45ef12 100644 --- a/test/tests.js +++ b/test/tests.js @@ -80,6 +80,22 @@ describe('Cache tests', function() { res = await fetch(TWO_HUNDRED_URL); assert.strictEqual(res.fromCache, true); }); + + it('Can eject from cache', async function() { + res = await fetch(TWO_HUNDRED_URL); + assert.strictEqual(res.fromCache, false); + + res = await fetch(TWO_HUNDRED_URL); + assert.strictEqual(res.fromCache, true); + + await res.ejectFromCache(); + + res = await fetch(TWO_HUNDRED_URL); + assert.strictEqual(res.fromCache, false); + + res = await fetch(TWO_HUNDRED_URL); + assert.strictEqual(res.fromCache, true); + }); }).timeout(10000); describe('Data tests', function() {