Browse Source

Test response objects have fromCache property set correctly

cache-clone-stream
Luke Childs 8 years ago
parent
commit
0ef2c4fc1e
  1. 4568
      package-lock.json
  2. 11
      test/cache.js

4568
package-lock.json

File diff suppressed because it is too large

11
test/cache.js

@ -181,6 +181,17 @@ test('Stale cache entries that can\'t be revalidate are deleted from cache', asy
t.is(firstResponse.body, secondResponse.body);
});
test('Response objects have fromCache property set correctly', async t => {
const endpoint = '/cache';
const cache = new Map();
const response = await got(s.url + endpoint, {cache});
const cachedResponse = await got(s.url + endpoint, {cache});
t.false(response.fromCache);
t.true(cachedResponse.fromCache);
});
test.after('cleanup', async () => {
await s.close();
});

Loading…
Cancel
Save