Skip to content

Commit

Permalink
chore: remove emit self tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Aug 19, 2020
1 parent eacd7ac commit e44efdc
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 304 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"eslint-plugin-standard": "^4.0.1",
"it-pair": "^1.0.0",
"libp2p": "https://github.com/libp2p/js-libp2p#0.29.x",
"libp2p-floodsub": "https://github.com/chainsafe/js-libp2p-floodsub#chore/update-pubsub",
"libp2p-floodsub": "https://github.com/libp2p/js-libp2p-floodsub#chore/update-pubsub",
"libp2p-mplex": "^0.9.5",
"libp2p-noise": "^1.1.2",
"libp2p-websockets": "^0.13.6",
Expand Down
2 changes: 1 addition & 1 deletion test/compliance.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const tests = require('libp2p-interfaces/src/pubsub/tests')

const Gossipsub = require('../src')
const { createPeers } = require('./utils/createPeer')
const { createPeers } = require('./utils/create-peer')

describe('interface compliance', () => {
let peers
Expand Down
60 changes: 0 additions & 60 deletions test/emit-self.spec.js

This file was deleted.

8 changes: 4 additions & 4 deletions test/floodsub.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe('gossipsub fallbacks to floodsub', () => {
// await subscription change
await Promise.all([
new Promise((resolve) => nodeGs.once('pubsub:subscription-change', resolve)),
new Promise((resolve) => nodeFs.once('floodsub:subscription-change', resolve))
new Promise((resolve) => nodeFs.once('pubsub:subscription-change', resolve))
])
})

Expand Down Expand Up @@ -273,7 +273,7 @@ describe('gossipsub fallbacks to floodsub', () => {
// await subscription change
await Promise.all([
new Promise((resolve) => nodeGs.once('pubsub:subscription-change', resolve)),
new Promise((resolve) => nodeFs.once('floodsub:subscription-change', resolve))
new Promise((resolve) => nodeFs.once('pubsub:subscription-change', resolve))
])
// allow subscriptions to propagate to the other peer
await delay(10)
Expand All @@ -292,7 +292,7 @@ describe('gossipsub fallbacks to floodsub', () => {
expect(nodeGs.subscriptions.size).to.equal(0)

const [changedPeerId, changedSubs] = await new Promise((resolve) => {
nodeFs.once('floodsub:subscription-change', (...args) => resolve(args))
nodeFs.once('pubsub:subscription-change', (...args) => resolve(args))
})

expect(nodeFs.peers.size).to.equal(1)
Expand All @@ -303,7 +303,7 @@ describe('gossipsub fallbacks to floodsub', () => {

it('Publish to a topic after unsubscribe', async () => {
nodeGs.unsubscribe(topic)
await new Promise((resolve) => nodeFs.once('floodsub:subscription-change', resolve))
await new Promise((resolve) => nodeFs.once('pubsub:subscription-change', resolve))

const promise = new Promise((resolve, reject) => {
nodeGs.once(topic, reject)
Expand Down
2 changes: 1 addition & 1 deletion test/message-cache.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ chai.use(chaiSpies)
const expect = chai.expect
const uint8ArrayFromString = require('uint8arrays/from-string')

const { MessageCache } = require('../src/messageCache')
const { MessageCache } = require('../src/message-cache')
const { utils } = require('libp2p-interfaces/src/pubsub')

const getMsgID = (msg) => {
Expand Down
226 changes: 0 additions & 226 deletions test/pubsub.spec.js

This file was deleted.

4 changes: 2 additions & 2 deletions test/utils/create-gossipsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ const {
*/
async function startNode(gs) {
await gs._libp2p.start()
await gs.start()
gs.start()
}

/**
* Stop node - gossipsub + libp2p
*/
async function stopNode(gs) {
await gs._libp2p.stop()
await gs.stop()
gs.stop()
}

/**
Expand Down
4 changes: 2 additions & 2 deletions test/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ const createPeerId = async () => {
exports.createPeerId = createPeerId

const createFloodsubNode = async (libp2p, shouldStart = false, options) => {
const fs = new FloodSub(libp2p.peerId, libp2p.registrar, options)
const fs = new FloodSub(libp2p, options)
fs._libp2p = libp2p

if (shouldStart) {
await libp2p.start()
await fs.start()
fs.start()
}

return fs
Expand Down
Loading

0 comments on commit e44efdc

Please sign in to comment.