diff --git a/package.json b/package.json index aaa88fa..68f4bd9 100644 --- a/package.json +++ b/package.json @@ -132,7 +132,7 @@ "dep-check": "aegir dep-check", "build": "aegir build", "generate": "protons ./src/message/rpc.proto", - "test": "aegir test -f dist/test", + "test": "aegir test", "test:chrome": "aegir test -t browser --cov", "test:chrome-webworker": "aegir test -t webworker", "test:firefox": "aegir test -t browser -- --browser firefox", @@ -142,22 +142,22 @@ "release": "aegir release" }, "dependencies": { - "@libp2p/interfaces": "^1.3.20", - "@libp2p/logger": "^1.1.3", - "@libp2p/pubsub": "^1.2.14", - "protons-runtime": "^1.0.2", + "@libp2p/interfaces": "^1.3.22", + "@libp2p/logger": "^1.1.4", + "@libp2p/pubsub": "^1.2.18", + "protons-runtime": "^1.0.3", "uint8arrays": "^3.0.0" }, "devDependencies": { - "@libp2p/interface-compliance-tests": "^1.1.21", - "@libp2p/peer-collections": "^1.0.1", - "@libp2p/peer-id": "^1.1.9", + "@libp2p/interface-compliance-tests": "^1.1.23", + "@libp2p/peer-collections": "^1.0.2", + "@libp2p/peer-id": "^1.1.10", "@libp2p/peer-id-factory": "^1.0.9", "@multiformats/multiaddr": "^10.1.8", - "aegir": "^37.0.7", + "aegir": "^37.0.14", "multiformats": "^9.4.5", "p-wait-for": "^4.1.0", - "protons": "^3.0.2", + "protons": "^3.0.3", "sinon": "^13.0.1", "wherearewe": "^1.0.0" } diff --git a/test/floodsub.spec.ts b/test/floodsub.spec.ts index a244b60..da34123 100644 --- a/test/floodsub.spec.ts +++ b/test/floodsub.spec.ts @@ -10,7 +10,6 @@ import { PeerStreams } from '@libp2p/pubsub/peer-streams' import { FloodSub, multicodec } from '../src/index.js' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { mockRegistrar } from '@libp2p/interface-compliance-tests/mocks' -import { CustomEvent } from '@libp2p/interfaces' import pWaitFor from 'p-wait-for' import { Components } from '@libp2p/interfaces/components' import { PeerSet } from '@libp2p/peer-collections' @@ -63,8 +62,10 @@ describe('floodsub', () => { } floodsub.subscribe(topic) - floodsub.addEventListener(topic, () => { - callCount++ + floodsub.addEventListener('message', (evt) => { + if (evt.detail.topic === topic) { + callCount++ + } }) // the message should not be in the cache @@ -99,7 +100,7 @@ describe('floodsub', () => { } expect(floodsub.send).to.have.property('callCount', 0) - await floodsub.dispatchEvent(new CustomEvent(topic, { detail: message })) + floodsub.publish(topic, message) await pWaitFor(async () => spy.callCount === 1)