Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

fix: enable last shard tests #4

Merged
merged 1 commit into from
Feb 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/commands/utils/hamt-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export const recreateInitialHamtLevel = async (links: PBLink[]): Promise<Bucket<
}, bucket, pos)

bucket._putObjectAt(pos, subBucket)
return
}

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

await addLinksToHamtBucket(blockstore, node.Links, subBucket, rootBucket, options)
return
}

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

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

// add intermediate links to bucket
await addLinksToHamtBucket(blockstore, node.Links, segment.bucket, rootBucket, options)

segment.node = node
}

await rootBucket.put(name, true)
Expand Down
4 changes: 2 additions & 2 deletions test/rm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ describe('rm', () => {
expect(containingDirCid).to.eql(importerCid)
})

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

it.skip('results in the same hash as a sharded directory created by the importer when removing a subshard of a subshard', async function () {
it('results in the same hash as a sharded directory created by the importer when removing a subshard of a subshard', async function () {
let {
containingDirCid,
fileName,
Expand Down