Skip to content

Commit 7a41f11

Browse files
committed
test: re-enables HAMT-sharded test
based on fix from #448
1 parent 14e7022 commit 7a41f11

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/interop/src/verified-fetch-unixfs-dir.spec.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { createVerifiedFetch } from '@helia/verified-fetch'
33
import { expect } from 'aegir/chai'
44
import { filetypemime } from 'magic-bytes.js'
5+
import sinon from 'sinon'
56
import { createKuboNode } from './fixtures/create-kubo.js'
67
import { loadFixtureDataCar } from './fixtures/load-fixture-data.js'
78
import type { VerifiedFetch } from '@helia/verified-fetch'
@@ -76,16 +77,22 @@ describe('@helia/verified-fetch - unixfs directory', () => {
7677
})
7778

7879
// TODO: find a smaller car file so the test doesn't timeout locally or flake on CI
79-
describe.skip('HAMT-sharded directory', () => {
80+
describe('HAMT-sharded directory', () => {
8081
before(async () => {
8182
// from https://github.com/ipfs/gateway-conformance/blob/193833b91f2e9b17daf45c84afaeeae61d9d7c7e/fixtures/trustless_gateway_car/single-layer-hamt-with-multi-block-files.car
8283
await loadFixtureDataCar(controller, 'bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i-single-layer-hamt-with-multi-block-files.car')
8384
})
8485

8586
it('loads path /ipfs/bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt', async () => {
86-
const resp = await verifiedFetch('ipfs://bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt')
87+
const onProgress = sinon.stub()
88+
const resp = await verifiedFetch('ipfs://bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt', { onProgress })
8789
expect(resp).to.be.ok()
8890
const text = await resp.text()
91+
const onProgressEvents = onProgress.getCalls().map(call => call.args[0])
92+
const walkEvents = onProgressEvents.filter((e) => e.type.includes('unixfs:exporter:walk'))
93+
const blockGetEvents = onProgressEvents.filter((e) => e.type === 'blocks:get:providers:get')
94+
expect(blockGetEvents).to.have.length(7)
95+
expect(walkEvents).to.have.length.lessThanOrEqual(8)
8996
// npx kubo@0.25.0 cat '/ipfs/bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt'
9097
expect(text).to.equal(`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc non imperdiet nunc. Proin ac quam ut nibh eleifend aliquet. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Sed ligula dolor, imperdiet sagittis arcu et, semper tincidunt urna. Donec et tempor augue, quis sollicitudin metus. Curabitur semper ullamcorper aliquet. Mauris hendrerit sodales lectus eget fermentum. Proin sollicitudin vestibulum commodo. Vivamus nec lectus eu augue aliquet dignissim nec condimentum justo. In hac habitasse platea dictumst. Mauris vel sem neque.
9198

0 commit comments

Comments
 (0)