Skip to content

Commit b76451e

Browse files
authored
chore: getSubscribers (#32)
BREAKING CHANGE: getPeersSubscribed renamed to getSubscribers to remove redundant wording
1 parent 1574023 commit b76451e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ class PubsubBaseProtocol extends EventEmitter {
273273
* @param {string} topic
274274
* @returns {Array<string>}
275275
*/
276-
getPeersSubscribed (topic) {
276+
getSubscribers (topic) {
277277
if (!this.started) {
278278
throw errcode(new Error('not started yet'), 'ERR_NOT_STARTED_YET')
279279
}

test/pubsub.spec.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ describe('pubsub base protocol', () => {
216216
})
217217
})
218218

219-
describe('getPeersSubscribed', () => {
219+
describe('getSubscribers', () => {
220220
let peerInfo
221221
let pubsub
222222

@@ -236,7 +236,7 @@ describe('pubsub base protocol', () => {
236236
const topic = 'topic-test'
237237

238238
try {
239-
pubsub.getPeersSubscribed(topic)
239+
pubsub.getSubscribers(topic)
240240
} catch (err) {
241241
expect(err).to.exist()
242242
expect(err.code).to.eql('ERR_NOT_STARTED_YET')
@@ -250,7 +250,7 @@ describe('pubsub base protocol', () => {
250250
await pubsub.start()
251251

252252
try {
253-
pubsub.getPeersSubscribed()
253+
pubsub.getSubscribers()
254254
} catch (err) {
255255
expect(err).to.exist()
256256
expect(err.code).to.eql('ERR_NOT_VALID_TOPIC')
@@ -265,7 +265,7 @@ describe('pubsub base protocol', () => {
265265
// start pubsub
266266
await pubsub.start()
267267

268-
let peersSubscribed = pubsub.getPeersSubscribed(topic)
268+
let peersSubscribed = pubsub.getSubscribers(topic)
269269
expect(peersSubscribed).to.be.empty()
270270

271271
// Set mock peer subscribed
@@ -275,7 +275,7 @@ describe('pubsub base protocol', () => {
275275
peer.topics.add(topic)
276276
pubsub.peers.set(id, peer)
277277

278-
peersSubscribed = pubsub.getPeersSubscribed(topic)
278+
peersSubscribed = pubsub.getSubscribers(topic)
279279

280280
expect(peersSubscribed).to.not.be.empty()
281281
expect(peersSubscribed[0]).to.eql(id)

0 commit comments

Comments
 (0)