feat: update pubsub getMsgId return type to Uint8Array (#65)

BREAKING CHANGE:
new getMsgId return type is not backwards compatible with prior `string`
return type.
This commit is contained in:
Cayman
2020-10-05 08:36:29 -06:00
committed by GitHub
parent ff3bd10704
commit e14844315b
5 changed files with 12 additions and 11 deletions

View File

@ -15,15 +15,11 @@ describe('utils', () => {
expect(first).to.not.eql(second)
})
it('msgId', () => {
expect(utils.msgId('hello', uint8ArrayFromString('world'))).to.be.eql('hello776f726c64')
})
it('msgId should not generate same ID for two different Uint8Arrays', () => {
const peerId = 'QmPNdSYk5Rfpo5euNqwtyizzmKXMNHdXeLjTQhcN4yfX22'
const msgId0 = utils.msgId(peerId, uint8ArrayFromString('15603533e990dfde', 'base16'))
const msgId1 = utils.msgId(peerId, uint8ArrayFromString('15603533e990dfe0', 'base16'))
expect(msgId0).to.not.eql(msgId1)
expect(msgId0).to.not.deep.equal(msgId1)
})
it('anyMatch', () => {