Skip to content

Commit cb3b5cc

Browse files
committed
chore: remove node buffers
There's no need to use node buffers, everything is `Uint8Array` compatible now. Needs the `libp2p-interfaces-compliance-tests` upgrade from ChainSafe#173 before CI will pass.
1 parent 6d7b2aa commit cb3b5cc

File tree

4 files changed

+5
-18
lines changed

4 files changed

+5
-18
lines changed

.aegir.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* set up a libp2p instance for browser nodes to relay through
66
* before tests start
77
*/
8-
const path = require('path')
98

109
const Libp2p = require('libp2p')
1110
const PeerId = require('peer-id')
@@ -45,28 +44,18 @@ const before = async () => {
4544
}
4645
}
4746
})
48-
47+
4948
await libp2p.start()
5049
}
5150

5251
const after = async () => {
5352
await libp2p.stop()
5453
}
5554

56-
/** @type {import('aegir').Options["build"]["config"]} */
57-
const esbuild = {
58-
inject: [path.join(__dirname, './scripts/node-globals.js')]
59-
}
60-
6155
/** @type {import('aegir').PartialOptions} */
6256
module.exports = {
6357
test: {
6458
before,
65-
after,
66-
browser: {
67-
config: {
68-
buildConfig: esbuild
69-
}
70-
}
59+
after
7160
}
7261
}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
"@typescript-eslint/parser": "^3.0.2",
5959
"aegir": "^35.0.1",
6060
"benchmark": "^2.1.4",
61-
"buffer": "^6.0.3",
6261
"chai": "^4.2.0",
6362
"chai-spies": "^1.0.0",
6463
"delay": "^5.0.0",

scripts/node-globals.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/gossip.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
'use strict'
22
/* eslint-env mocha */
33

4-
const { Buffer } = require('buffer')
54
const { expect } = require('chai')
65
const sinon = require('sinon')
76
const delay = require('delay')
7+
const { fromString: uint8ArrayFromString } = require('uint8arrays/from-string')
88

99
const { GossipsubDhi } = require('../src/constants')
1010
const {
@@ -41,7 +41,7 @@ describe('gossip', () => {
4141
// set spy
4242
sinon.spy(nodeA, '_pushGossip')
4343

44-
await nodeA.publish(topic, Buffer.from('hey'))
44+
await nodeA.publish(topic, uint8ArrayFromString('hey'))
4545

4646
await new Promise((resolve) => nodeA.once('gossipsub:heartbeat', resolve))
4747

@@ -82,7 +82,7 @@ describe('gossip', () => {
8282
const graft = { graft: [{ topicID: topic }] }
8383
nodeA.control.set(peerB, graft)
8484

85-
await nodeA.publish(topic, Buffer.from('hey'))
85+
await nodeA.publish(topic, uint8ArrayFromString('hey'))
8686

8787
expect(nodeA._piggybackControl.callCount).to.be.equal(1)
8888
// expect control message to be sent alongside published message

0 commit comments

Comments
 (0)