From 5cb5c8aaa16fd2312ae185c378420b5024fc5015 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Wed, 17 Apr 2024 14:31:31 -0700 Subject: [PATCH] test(fix): custom dns-resolvers test --- .../test/custom-dns-resolvers.spec.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/packages/verified-fetch/test/custom-dns-resolvers.spec.ts b/packages/verified-fetch/test/custom-dns-resolvers.spec.ts index 2f16cbe8..0a17c248 100644 --- a/packages/verified-fetch/test/custom-dns-resolvers.spec.ts +++ b/packages/verified-fetch/test/custom-dns-resolvers.spec.ts @@ -10,10 +10,6 @@ import type { Helia } from '@helia/interface' describe('custom dns-resolvers', () => { let helia: Helia - beforeEach(async () => { - helia = await createHelia() - }) - afterEach(async () => { await stop(helia) }) @@ -27,19 +23,19 @@ describe('custom dns-resolvers', () => { const fetch = await createVerifiedFetch({ gateways: ['http://127.0.0.1:8080'], + routers: [], dnsResolvers: [customDnsResolver] }) - const response = await fetch('ipns://some-non-cached-domain.com', { session: false }) + const response = await fetch('ipns://some-non-cached-domain.com') expect(response.status).to.equal(502) expect(response.statusText).to.equal('Bad Gateway') expect(customDnsResolver.callCount).to.equal(1) - expect(customDnsResolver.getCall(0).args[0]).to.equal('_dnslink.some-non-cached-domain.com') - expect(customDnsResolver.getCall(0).args[1]).to.deep.include({ + expect(customDnsResolver.getCall(0).args).to.deep.equal(['_dnslink.some-non-cached-domain.com', { types: [ RecordType.TXT ] - }) + }]) }) it('is used when passed to VerifiedFetch', async () => { @@ -62,17 +58,16 @@ describe('custom dns-resolvers', () => { helia }) - const response = await verifiedFetch.fetch('ipns://some-non-cached-domain2.com', { session: false }) + const response = await verifiedFetch.fetch('ipns://some-non-cached-domain2.com') expect(response.status).to.equal(502) expect(response.statusText).to.equal('Bad Gateway') expect(customDnsResolver.callCount).to.equal(1) - expect(customDnsResolver.getCall(0).args[0]).to.equal('_dnslink.some-non-cached-domain2.com') - expect(customDnsResolver.getCall(0).args[1]).to.deep.include({ + expect(customDnsResolver.getCall(0).args).to.deep.equal(['_dnslink.some-non-cached-domain2.com', { types: [ RecordType.TXT ] - }) + }]) }) })