Skip to content

Commit

Permalink
Test aborted want.
Browse files Browse the repository at this point in the history
  • Loading branch information
saul-jb committed Mar 15, 2024
1 parent 5e410d7 commit 0f36777
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/manual-block-broker/test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,18 @@ describe('manual block broker', () => {

assert.deepEqual(wants, [])
})

it('getWants no longer returns the CID when it is aborted', async () => {
const bb = new ManualBlockBroker()
const controller = new AbortController()
const promise = bb.retrieve(cid, { signal: controller.signal })

controller.abort()

await assert.rejects(async () => promise)

const wants = [...bb.getWants()]

assert.deepEqual(wants, [])
})
})

0 comments on commit 0f36777

Please sign in to comment.