Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 32c722b

Browse files
committed
unitest to support unsubscribeAll
1 parent b004848 commit 32c722b

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

README.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,31 @@
3333

3434
## Table of Contents
3535

36+
- [Lead Maintainer](#lead-maintainer)
37+
- [Table of Contents](#table-of-contents)
3638
- [Install](#install)
3739
- [Running the daemon with the right port](#running-the-daemon-with-the-right-port)
3840
- [Importing the module and usage](#importing-the-module-and-usage)
3941
- [Importing a sub-module and usage](#importing-a-sub-module-and-usage)
40-
- [In a web browser through Browserify](#in-a-web-browser-through-browserify)
41-
- [In a web browser from CDN](#in-a-web-browser-from-cdn)
42+
- [In a web browser](#in-a-web-browser)
4243
- [CORS](#cors)
44+
- [Custom Headers](#custom-headers)
4345
- [Usage](#usage)
44-
- [API Docs](#api)
45-
- [Callbacks and promises](#callbacks-and-promises)
46+
- [API](#api)
47+
- [Files](#files)
48+
- [Graph](#graph)
49+
- [Network](#network)
50+
- [Node Management](#node-management)
51+
- [Pubsub Caveat](#pubsub-caveat)
52+
- [Domain data types](#domain-data-types)
53+
- [Extra (util) functions](#extra-util-functions)
54+
- [Get endpoint configuration (host and port)](#get-endpoint-configuration-host-and-port)
55+
- [Get libp2p crypto primitives](#get-libp2p-crypto-primitives)
56+
- [Get is-ipfs utilities](#get-is-ipfs-utilities)
57+
- [Development](#development)
58+
- [Testing](#testing)
4659
- [Contribute](#contribute)
60+
- [Historical context](#historical-context)
4761
- [License](#license)
4862

4963
## Install
@@ -271,6 +285,7 @@ const ipfs = ipfsClient({
271285
- [`ipfs.pubsub.publish(topic, data, [callback])`](https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/PUBSUB.md#pubsubpublish)
272286
- [`ipfs.pubsub.subscribe(topic, handler, [options], [callback])`](https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/PUBSUB.md#pubsubsubscribe)
273287
- [`ipfs.pubsub.unsubscribe(topic, handler, [callback])`](https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/PUBSUB.md#pubsubunsubscribe)
288+
- [`ipfs.pubsub.unsubscribeAll(topic, [callback])`]()
274289

275290
- [swarm](https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/SWARM.md)
276291
- [`ipfs.swarm.addrs([callback])`](https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/SWARM.md#swarmaddrs)

test/pubsub-in-browser.spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,13 @@ describe('.pubsub is not supported in the browser, yet!', function () {
159159
})
160160
})
161161
})
162+
describe('.unsubscribeAll', () => {
163+
it('throws an error if called in the browser', (done) => {
164+
ipfs.pubsub.unsubscribeAll('test', (err) => {
165+
expect(err).to.exist()
166+
expect(err.message).to.equal(expectedError)
167+
done()
168+
})
169+
})
170+
})
162171
})

0 commit comments

Comments
 (0)