Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit c254552

Browse files
committed
chore: update deps, allow tests to run offline
1 parent 93736ef commit c254552

File tree

7 files changed

+150
-29
lines changed

7 files changed

+150
-29
lines changed

packages/interface-ipfs-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"aegir": "^37.0.11",
8181
"blockstore-core": "^2.0.1",
8282
"copyfiles": "^2.4.1",
83-
"dag-jose": "^3.0.0",
83+
"dag-jose": "^3.0.1",
8484
"delay": "^5.0.0",
8585
"did-jwt": "^6.2.0",
8686
"err-code": "^3.0.1",

packages/interface-ipfs-core/src/miscellaneous/dns.js

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ export function testDns (factory, options) {
2929
after(() => factory.clean())
3030

3131
it('should non-recursively resolve ipfs.io', async function () {
32+
const domain = 'ipfs.io'
33+
3234
try {
33-
const res = await ipfs.dns('ipfs.io', { recursive: false })
35+
const res = await ipfs.dns(domain, { recursive: false })
3436

3537
// matches pattern /ipns/<ipnsaddress>
3638
expect(res).to.match(/\/ipns\/.+$/)
@@ -40,13 +42,21 @@ export function testDns (factory, options) {
4042
return this.skip()
4143
}
4244

45+
// happens when running tests offline
46+
if (err.message.includes(`ECONNREFUSED ${domain}`)) {
47+
// @ts-expect-error this is mocha
48+
return this.skip()
49+
}
50+
4351
throw err
4452
}
4553
})
4654

4755
it('should recursively resolve ipfs.io', async function () {
56+
const domain = 'ipfs.io'
57+
4858
try {
49-
const res = await ipfs.dns('ipfs.io', { recursive: true })
59+
const res = await ipfs.dns(domain, { recursive: true })
5060

5161
// matches pattern /ipfs/<hash>
5262
expect(res).to.match(/\/ipfs\/.+$/)
@@ -56,13 +66,21 @@ export function testDns (factory, options) {
5666
return this.skip()
5767
}
5868

69+
// happens when running tests offline
70+
if (err.message.includes(`ECONNREFUSED ${domain}`)) {
71+
// @ts-expect-error this is mocha
72+
return this.skip()
73+
}
74+
5975
throw err
6076
}
6177
})
6278

6379
it('should resolve subdomain docs.ipfs.io', async function () {
80+
const domain = 'docs.ipfs.io'
81+
6482
try {
65-
const res = await ipfs.dns('docs.ipfs.io')
83+
const res = await ipfs.dns(domain)
6684

6785
// matches pattern /ipfs/<hash>
6886
expect(res).to.match(/\/ipfs\/.+$/)
@@ -72,6 +90,12 @@ export function testDns (factory, options) {
7290
return this.skip()
7391
}
7492

93+
// happens when running tests offline
94+
if (err.message.includes(`ECONNREFUSED ${domain}`)) {
95+
// @ts-expect-error this is mocha
96+
return this.skip()
97+
}
98+
7599
throw err
76100
}
77101
})

packages/interface-ipfs-core/src/miscellaneous/resolve.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,21 @@ export function testResolve (factory, options) {
9696
it('should resolve an IPNS DNS link', async function () {
9797
// @ts-expect-error this is mocha
9898
this.retries(3)
99-
const resolved = await ipfs.resolve('/ipns/ipfs.io')
99+
const domain = 'ipfs.io'
100100

101-
expect(isIpfs.ipfsPath(resolved)).to.be.true()
101+
try {
102+
const resolved = await ipfs.resolve(`/ipns/${domain}`)
103+
104+
expect(isIpfs.ipfsPath(resolved)).to.be.true()
105+
} catch (/** @type {any} */ err) {
106+
// happens when running tests offline
107+
if (err.message.includes(`ECONNREFUSED ${domain}`)) {
108+
// @ts-expect-error this is mocha
109+
return this.skip()
110+
}
111+
112+
throw err
113+
}
102114
})
103115

104116
it('should resolve IPNS link recursively by default', async function () {

packages/interface-ipfs-core/src/name/resolve.js

Lines changed: 105 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -160,34 +160,106 @@ export function testResolve (factory, options) {
160160

161161
after(() => factory.clean())
162162

163-
it('should resolve /ipns/ipfs.io', async () => {
164-
expect(await last(ipfs.name.resolve('/ipns/ipfs.io')))
165-
.to.match(/\/ipfs\/.+$/)
163+
it('should resolve /ipns/ipfs.io', async function () {
164+
const domain = 'ipfs.io'
165+
166+
try {
167+
expect(await last(ipfs.name.resolve(`/ipns/${domain}`)))
168+
.to.match(/\/ipfs\/.+$/)
169+
} catch (/** @type {any} */ err) {
170+
// happens when running tests offline
171+
if (err.message.includes(`ECONNREFUSED ${domain}`)) {
172+
// @ts-expect-error this is mocha
173+
return this.skip()
174+
}
175+
176+
throw err
177+
}
166178
})
167179

168-
it('should resolve /ipns/ipfs.io recursive === false', async () => {
169-
expect(await last(ipfs.name.resolve('/ipns/ipfs.io', { recursive: false })))
170-
.to.match(/\/ipns\/.+$/)
180+
it('should resolve /ipns/ipfs.io recursive === false', async function () {
181+
const domain = 'ipfs.io'
182+
183+
try {
184+
expect(await last(ipfs.name.resolve(`/ipns/${domain}`, { recursive: false })))
185+
.to.match(/\/ipns\/.+$/)
186+
} catch (/** @type {any} */ err) {
187+
// happens when running tests offline
188+
if (err.message.includes(`ECONNREFUSED ${domain}`)) {
189+
// @ts-expect-error this is mocha
190+
return this.skip()
191+
}
192+
193+
throw err
194+
}
171195
})
172196

173-
it('should resolve /ipns/ipfs.io recursive === true', async () => {
174-
expect(await last(ipfs.name.resolve('/ipns/ipfs.io', { recursive: true })))
175-
.to.match(/\/ipfs\/.+$/)
197+
it('should resolve /ipns/ipfs.io recursive === true', async function () {
198+
const domain = 'ipfs.io'
199+
200+
try {
201+
expect(await last(ipfs.name.resolve(`/ipns/${domain}`, { recursive: true })))
202+
.to.match(/\/ipfs\/.+$/)
203+
} catch (/** @type {any} */ err) {
204+
// happens when running tests offline
205+
if (err.message.includes(`ECONNREFUSED ${domain}`)) {
206+
// @ts-expect-error this is mocha
207+
return this.skip()
208+
}
209+
210+
throw err
211+
}
176212
})
177213

178-
it('should resolve /ipns/ipfs.io with remainder', async () => {
179-
expect(await last(ipfs.name.resolve('/ipns/ipfs.io/images/ipfs-logo.svg')))
180-
.to.match(/\/ipfs\/.+\/images\/ipfs-logo.svg$/)
214+
it('should resolve /ipns/ipfs.io with remainder', async function () {
215+
const domain = 'ipfs.io'
216+
217+
try {
218+
expect(await last(ipfs.name.resolve(`/ipns/${domain}/images/ipfs-logo.svg`)))
219+
.to.match(/\/ipfs\/.+\/images\/ipfs-logo.svg$/)
220+
} catch (/** @type {any} */ err) {
221+
// happens when running tests offline
222+
if (err.message.includes(`ECONNREFUSED ${domain}`)) {
223+
// @ts-expect-error this is mocha
224+
return this.skip()
225+
}
226+
227+
throw err
228+
}
181229
})
182230

183-
it('should resolve /ipns/ipfs.io with remainder recursive === false', async () => {
184-
expect(await last(ipfs.name.resolve('/ipns/ipfs.io/images/ipfs-logo.svg', { recursive: false })))
185-
.to.match(/\/ipns\/.+\/images\/ipfs-logo.svg$/)
231+
it('should resolve /ipns/ipfs.io with remainder recursive === false', async function () {
232+
const domain = 'ipfs.io'
233+
234+
try {
235+
expect(await last(ipfs.name.resolve(`/ipns/${domain}/images/ipfs-logo.svg`, { recursive: false })))
236+
.to.match(/\/ipns\/.+\/images\/ipfs-logo.svg$/)
237+
} catch (/** @type {any} */ err) {
238+
// happens when running tests offline
239+
if (err.message.includes(`ECONNREFUSED ${domain}`)) {
240+
// @ts-expect-error this is mocha
241+
return this.skip()
242+
}
243+
244+
throw err
245+
}
186246
})
187247

188-
it('should resolve /ipns/ipfs.io with remainder recursive === true', async () => {
189-
expect(await last(ipfs.name.resolve('/ipns/ipfs.io/images/ipfs-logo.svg', { recursive: true })))
190-
.to.match(/\/ipfs\/.+\/images\/ipfs-logo.svg$/)
248+
it('should resolve /ipns/ipfs.io with remainder recursive === true', async function () {
249+
const domain = 'ipfs.io'
250+
251+
try {
252+
expect(await last(ipfs.name.resolve(`/ipns/${domain}/images/ipfs-logo.svg`, { recursive: true })))
253+
.to.match(/\/ipfs\/.+\/images\/ipfs-logo.svg$/)
254+
} catch (/** @type {any} */ err) {
255+
// happens when running tests offline
256+
if (err.message.includes(`ECONNREFUSED ${domain}`)) {
257+
// @ts-expect-error this is mocha
258+
return this.skip()
259+
}
260+
261+
throw err
262+
}
191263
})
192264

193265
it('should fail to resolve /ipns/ipfs.a', async () => {
@@ -198,9 +270,21 @@ export function testResolve (factory, options) {
198270
}
199271
})
200272

201-
it('should resolve ipns path with hamt-shard recursive === true', async () => {
202-
expect(await last(ipfs.name.resolve('/ipns/tr.wikipedia-on-ipfs.org/wiki/Anasayfa.html', { recursive: true })))
203-
.to.match(/\/ipfs\/.+$/)
273+
it('should resolve ipns path with hamt-shard recursive === true', async function () {
274+
const domain = 'tr.wikipedia-on-ipfs.org'
275+
276+
try {
277+
expect(await last(ipfs.name.resolve(`/ipns/${domain}/wiki/Anasayfa.html`, { recursive: true })))
278+
.to.match(/\/ipfs\/.+$/)
279+
} catch (/** @type {any} */ err) {
280+
// happens when running tests offline
281+
if (err.message.includes(`ECONNREFUSED ${domain}`)) {
282+
// @ts-expect-error this is mocha
283+
return this.skip()
284+
}
285+
286+
throw err
287+
}
204288
})
205289
})
206290
}

packages/ipfs-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
"any-signal": "^3.0.0",
103103
"array-shuffle": "^3.0.0",
104104
"blockstore-core": "^2.0.1",
105-
"dag-jose": "^3.0.0",
105+
"dag-jose": "^3.0.1",
106106
"datastore-core": "^8.0.1",
107107
"datastore-pubsub": "^6.0.0",
108108
"dlv": "^1.1.3",

packages/ipfs-http-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"@libp2p/peer-id": "^1.1.10",
7575
"@multiformats/multiaddr": "^11.0.0",
7676
"any-signal": "^3.0.0",
77-
"dag-jose": "^3.0.0",
77+
"dag-jose": "^3.0.1",
7878
"err-code": "^3.0.1",
7979
"ipfs-core-types": "^0.12.1",
8080
"ipfs-core-utils": "^0.16.1",

packages/ipfs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
"ipfs-utils": "^9.0.6",
100100
"ipfsd-ctl": "^12.0.3",
101101
"iso-url": "^1.0.0",
102+
"kubo-rpc-client": "^1.0.1",
102103
"merge-options": "^3.0.4",
103104
"mock-ipfs-pinning-service": "^0.4.2",
104105
"url": "^0.11.0",

0 commit comments

Comments
 (0)