Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite main logic #31

Merged
merged 22 commits into from
May 9, 2020
Merged
Prev Previous commit
Next Next commit
test fallback
  • Loading branch information
szmarczak committed May 9, 2020
commit 664c2e9a10d73181ff28484ff09358741f04e5a7
8 changes: 8 additions & 0 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,14 @@ test.serial('fallback works', async t => {
});
});

test('fallback can be turned off', async t => {
const cacheable = new CacheableLookup({resolver, fallbackDuration: 0});

await t.throwsAsync(cacheable.lookupAsync('osHostname', {all: true}), {
message: 'cacheableLookup ENOTFOUND osHostname'
});
});

test('errors are cached', async t => {
const cacheable = new CacheableLookup({resolver, errorTtl: 0.1});

Expand Down