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

Commit 94d8bbc

Browse files
committed
Make test descriptions more explicit. Use 'err' instead of 'e'.
1 parent 599020b commit 94d8bbc

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

test/pubsub-in-browser.spec.js

+25-25
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ if (!isNode) {
7676
describe('everything errors', () => {
7777
describe('Callback API', () => {
7878
describe('.publish', () => {
79-
it('throws an error', (done) => {
79+
it('throws an error if called in the browser', (done) => {
8080
ipfs1.pubsub.publish(topic, 'hello friend', (err, topics) => {
8181
expect(err).to.exist
8282
expect(err.message).to.equal(expectedError)
@@ -87,7 +87,7 @@ if (!isNode) {
8787

8888
describe('.subscribe', () => {
8989
const handler = () => {}
90-
it('throws an error', (done) => {
90+
it('throws an error if called in the browser', (done) => {
9191
ipfs1.pubsub.subscribe(topic, {}, handler, (err, topics) => {
9292
expect(err).to.exist
9393
expect(err.message).to.equal(expectedError)
@@ -97,7 +97,7 @@ if (!isNode) {
9797
})
9898

9999
describe('.peers', () => {
100-
it('throws an error', (done) => {
100+
it('throws an error if called in the browser', (done) => {
101101
ipfs1.pubsub.peers(topic, (err, topics) => {
102102
expect(err).to.exist
103103
expect(err.message).to.equal(expectedError)
@@ -107,7 +107,7 @@ if (!isNode) {
107107
})
108108

109109
describe('.ls', () => {
110-
it('throws an error', (done) => {
110+
it('throws an error if called in the browser', (done) => {
111111
ipfs1.pubsub.ls((err, topics) => {
112112
expect(err).to.exist
113113
expect(err.message).to.equal(expectedError)
@@ -119,57 +119,57 @@ if (!isNode) {
119119

120120
describe('Promise API', () => {
121121
describe('.publish', () => {
122-
it('throws an error', () => {
122+
it('throws an error if called in the browser', () => {
123123
return ipfs1.pubsub.publish(topic, 'hello friend')
124-
.catch((e) => {
125-
expect(e).to.exist
126-
expect(e.message).to.equal(expectedError)
124+
.catch((err) => {
125+
expect(err).to.exist
126+
expect(err.message).to.equal(expectedError)
127127
})
128128
})
129129
})
130130

131131
describe('.subscribe', () => {
132132
const handler = () => {}
133-
it('throws an error', (done) => {
133+
it('throws an error if called in the browser', (done) => {
134134
ipfs1.pubsub.subscribe(topic, {}, handler)
135-
.catch((e) => {
136-
expect(e).to.exist
137-
expect(e.message).to.equal(expectedError)
135+
.catch((err) => {
136+
expect(err).to.exist
137+
expect(err.message).to.equal(expectedError)
138138
done()
139139
})
140140
})
141141
})
142142

143143
describe('.peers', () => {
144-
it('throws an error', (done) => {
144+
it('throws an error if called in the browser', (done) => {
145145
ipfs1.pubsub.peers(topic)
146-
.catch((e) => {
147-
expect(e).to.exist
148-
expect(e.message).to.equal(expectedError)
146+
.catch((err) => {
147+
expect(err).to.exist
148+
expect(err.message).to.equal(expectedError)
149149
done()
150150
})
151151
})
152152
})
153153

154154
describe('.ls', () => {
155-
it('throws an error', () => {
155+
it('throws an error if called in the browser', () => {
156156
return ipfs1.pubsub.ls()
157-
.catch((e) => {
158-
expect(e).to.exist
159-
expect(e.message).to.equal(expectedError)
157+
.catch((err) => {
158+
expect(err).to.exist
159+
expect(err.message).to.equal(expectedError)
160160
})
161161
})
162162
})
163163
})
164164

165165
describe('.unsubscribe', () => {
166-
it('throws an error', (done) => {
166+
it('throws an error if called in the browser', (done) => {
167167
try {
168-
ipfs1.pubsub.unsubscribe(topic)
168+
ipfs1.pubsub.unsubscribe()
169169
done('unsubscribe() didn\'t throw an error')
170-
} catch (e) {
171-
expect(e).to.exist
172-
expect(e.message).to.equal(expectedError)
170+
} catch (err) {
171+
expect(err).to.exist
172+
expect(err.message).to.equal(expectedError)
173173
done()
174174
}
175175
})

0 commit comments

Comments
 (0)