Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Commit

Permalink
fix: add test for v1->v1 conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdukakis committed Apr 28, 2021
1 parent 35de2f0 commit de28c1f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,12 @@ describe('CID', () => {
expect(cid.version).to.equal(0)
})

it('should convert v1 to v1', async () => {
const hash = await multihashing(uint8ArrayFromString(`TEST${Date.now()}`), 'sha2-256')
const cid = new CID(1, 'dag-pb', hash, 'base2').toV1()
expect(cid.multibaseName).to.equal('base2')
})

it('should not convert v1 to v0 if not dag-pb codec', async () => {
const hash = await multihashing(uint8ArrayFromString(`TEST${Date.now()}`), 'sha2-256')
const cid = new CID(1, 'dag-cbor', hash)
Expand Down

0 comments on commit de28c1f

Please sign in to comment.