Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
chore: address review
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Nov 5, 2019
1 parent 5b4f41b commit afd1049
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ TODO: add explanation for registrar!
const Pubsub = require('libp2p-pubsub')

class PubsubImplementation extends Pubsub {
constructor(peerInfo, registrar, options = {}) {
constructor({ peerInfo, registrar, ...options })
super({
debugName: 'libp2p:pubsub',
multicodecs: '/pubsub-implementation/1.0.0',
Expand Down Expand Up @@ -90,7 +90,7 @@ The following specified API should be the base API for a pubsub implementation o

### Start

Start the pubsub subsystem. The protocol will be registered to `libp2p`, which will notify about peers being connected and disconnected with the protocol.
Starts the pubsub subsystem. The protocol will be registered to `libp2p`, which will result in pubsub being notified when peers who support the protocol connect/disconnect to `libp2p`.

#### `pubsub.start()`

Expand All @@ -102,7 +102,7 @@ Start the pubsub subsystem. The protocol will be registered to `libp2p`, which w

### Stop

Stop the pubsub subsystem. The protocol will be unregistered to `libp2p`, which will remove all listeners for the protocol and the streams with other peers will be closed.
Stops the pubsub subsystem. The protocol will be unregistered from `libp2p`, which will remove all listeners for the protocol and the established connections will be closed.

#### `pubsub.stop()`

Expand Down Expand Up @@ -169,7 +169,7 @@ Get the list of topics which the peer is subscribed to.

### Get Peers Subscribed to a topic

Get a list of the peer-ids that are subscribed to one topic.
Get a list of the [PeerId](https://github.com/libp2p/js-peer-id) strings that are subscribed to one topic.

#### `pubsub.getPeersSubscribed(topic)`

Expand Down
6 changes: 3 additions & 3 deletions test/pubsub.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('pubsub base protocol', () => {
expect(sinonMockRegistrar.unregister.calledOnce).to.be.true()
})

it('should not throw to start if already started', async () => {
it('starting should not throw if already started', async () => {
await pubsub.start()
await pubsub.start()
expect(sinonMockRegistrar.handle.calledOnce).to.be.true()
Expand All @@ -63,14 +63,14 @@ describe('pubsub base protocol', () => {
expect(sinonMockRegistrar.unregister.calledOnce).to.be.true()
})

it('should not throw if stop before start', async () => {
it('stopping should not throw if not started', async () => {
await pubsub.stop()
expect(sinonMockRegistrar.register.calledOnce).to.be.false()
expect(sinonMockRegistrar.unregister.calledOnce).to.be.false()
})
})

describe('should handle messages creating and signing', () => {
describe('should handle message creation and signing', () => {
let peerInfo
let pubsub

Expand Down

0 comments on commit afd1049

Please sign in to comment.