mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-18 19:51:23 +00:00
fix: replace node buffers with uint8arrays (#730)
* fix: replace node buffers with uint8arrays Upgrades all deps and replaces all use of node Buffers with Uint8Arrays BREAKING CHANGES: - All deps used by this module now use Uint8Arrays in place of node Buffers * chore: browser fixes * chore: remove .only * chore: stringify uint8array before parsing * chore: update interop suite * chore: remove ts from build command * chore: update deps * fix: update records to use uint8array * chore: fix lint * chore: update deps Co-authored-by: Jacob Heun <jacobheun@gmail.com>
This commit is contained in:
committed by
Jacob Heun
parent
9107efe121
commit
1e869717ff
@ -1,14 +1,12 @@
|
||||
'use strict'
|
||||
/* eslint-env mocha */
|
||||
|
||||
const { Buffer } = require('buffer')
|
||||
const chai = require('chai')
|
||||
chai.use(require('dirty-chai'))
|
||||
const { expect } = chai
|
||||
const { expect } = require('aegir/utils/chai')
|
||||
|
||||
const multiaddr = require('multiaddr')
|
||||
const pWaitFor = require('p-wait-for')
|
||||
const mergeOptions = require('merge-options')
|
||||
const uint8ArrayFromString = require('uint8arrays/from-string')
|
||||
|
||||
const { create } = require('../../../src')
|
||||
const { subsystemOptions, subsystemMulticodecs } = require('./utils')
|
||||
@ -68,8 +66,8 @@ describe('DHT subsystem operates correctly', () => {
|
||||
})
|
||||
|
||||
it('should put on a peer and get from the other', async () => {
|
||||
const key = Buffer.from('hello')
|
||||
const value = Buffer.from('world')
|
||||
const key = uint8ArrayFromString('hello')
|
||||
const value = uint8ArrayFromString('world')
|
||||
|
||||
await libp2p.dialProtocol(remAddr, subsystemMulticodecs)
|
||||
await Promise.all([
|
||||
@ -131,8 +129,8 @@ describe('DHT subsystem operates correctly', () => {
|
||||
it('should put on a peer and get from the other', async () => {
|
||||
await libp2p.dial(remAddr)
|
||||
|
||||
const key = Buffer.from('hello')
|
||||
const value = Buffer.from('world')
|
||||
const key = uint8ArrayFromString('hello')
|
||||
const value = uint8ArrayFromString('world')
|
||||
|
||||
await remoteLibp2p._dht.start()
|
||||
await pWaitFor(() => libp2p._dht.routingTable.size === 1)
|
||||
|
Reference in New Issue
Block a user