Skip to content

Commit

Permalink
test: add test for ambiguous codecs
Browse files Browse the repository at this point in the history
The codec `ipfs` and `p2p` both are assigned to `0x01a5`, where `ipfs` is the
deprecated name. Make sure that we resolve to `p2p` if that number is used
as input.
  • Loading branch information
vmx committed Sep 19, 2019
1 parent fe8608c commit d46b91f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/multicodec.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ describe('multicodec', () => {
expect(multicodec.print[0xb201]).to.eql('blake2b-8')
})

it('returns p2p when 0x01a5 is used', () => {
// `ipfs` and `p2p` are assigned to `0x01a5`, `ipfs` is deprecated
expect(multicodec.print[0x01a5]).to.eql('p2p')
})

it('throws error on unknown codec name when getting the code', () => {
expect(() => {
multicodec.getCodeVarint('this-codec-doesnt-exist')
Expand Down

0 comments on commit d46b91f

Please sign in to comment.