Skip to content

Commit

Permalink
chore: test getCodeFromName throw
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
  • Loading branch information
hacdias committed Dec 12, 2020
1 parent e93b439 commit 8e26a3b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/multicodec.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('multicodec', () => {
expect(multicodec.getNameFromCode(0x01a5)).to.eql('p2p')
})

it('throws error on unknown codec name when getting the code', () => {
it('throws error on unknown codec name when getting the varint from name', () => {
expect(() => {
// @ts-expect-error
multicodec.getVarintFromName('this-codec-doesnt-exist')
Expand All @@ -98,7 +98,16 @@ describe('multicodec', () => {
)
})

it('throws error on unknown codec name when getting the codec', () => {
it('throws error on unknown codec name when getting the code from name', () => {
expect(() => {
// @ts-expect-error
multicodec.getCodeFromName('this-codec-doesnt-exist')
}).to.throw(
'Codec "this-codec-doesnt-exist" not found'
)
})

it('throws error on unknown codec name when getting the name from the code', () => {
const code = uint8ArrayFromString('ffee', 'base16')

const buf = uint8ArrayFromString('hey')
Expand Down

0 comments on commit 8e26a3b

Please sign in to comment.