Skip to content

Commit 9774460

Browse files
authored
fix: enable last shard tests (#4)
Fixes up traversing deep shards
1 parent 9d4799b commit 9774460

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/commands/utils/hamt-utils.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export const recreateInitialHamtLevel = async (links: PBLink[]): Promise<Bucket<
9696
}, bucket, pos)
9797

9898
bucket._putObjectAt(pos, subBucket)
99+
return
99100
}
100101

101102
await bucket.put(linkName.substring(2), {
@@ -126,6 +127,7 @@ export const addLinksToHamtBucket = async (blockstore: Blockstore, links: PBLink
126127
bucket._putObjectAt(pos, subBucket)
127128

128129
await addLinksToHamtBucket(blockstore, node.Links, subBucket, rootBucket, options)
130+
return
129131
}
130132

131133
await rootBucket.put(linkName.substring(2), {
@@ -218,7 +220,7 @@ export const generatePath = async (root: Directory, name: string, blockstore: Bl
218220
// found subshard
219221
log(`Found subshard ${segment.prefix}`)
220222
const block = await blockstore.get(link.Hash)
221-
const node = dagPB.decode(block)
223+
const node = segment.node = dagPB.decode(block)
222224

223225
// subshard hasn't been loaded, descend to the next level of the HAMT
224226
if (path[i + 1] == null) {
@@ -247,8 +249,6 @@ export const generatePath = async (root: Directory, name: string, blockstore: Bl
247249

248250
// add intermediate links to bucket
249251
await addLinksToHamtBucket(blockstore, node.Links, segment.bucket, rootBucket, options)
250-
251-
segment.node = node
252252
}
253253

254254
await rootBucket.put(name, true)

test/rm.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ describe('rm', () => {
174174
expect(containingDirCid).to.eql(importerCid)
175175
})
176176

177-
it.skip('results in the same hash as a sharded directory created by the importer when removing a subshard', async function () {
177+
it('results in the same hash as a sharded directory created by the importer when removing a subshard', async function () {
178178
let {
179179
containingDirCid,
180180
fileName,
@@ -195,7 +195,7 @@ describe('rm', () => {
195195
expect(containingDirCid).to.eql(importerCid)
196196
})
197197

198-
it.skip('results in the same hash as a sharded directory created by the importer when removing a subshard of a subshard', async function () {
198+
it('results in the same hash as a sharded directory created by the importer when removing a subshard of a subshard', async function () {
199199
let {
200200
containingDirCid,
201201
fileName,

0 commit comments

Comments
 (0)