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

Commit 8174b52

Browse files
committed
fix .cat test
1 parent 253d5b6 commit 8174b52

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

test/tests.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -152,23 +152,27 @@ describe('IPFS Node.js API wrapper tests', function () {
152152
this.timeout(10000)
153153

154154
apiClients['a'].cat('Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP', function (err, res) {
155-
if (err) throw err
156-
157-
if (typeof res === 'string') {
158-
// Just a string
159-
assert.equal(res, testfile)
160-
done()
161-
return
155+
if (err) {
156+
throw err
162157
}
163158

164-
var buf = ''
165-
res
166-
.on('error', function (err) { throw err })
167-
.on('data', function (data) { buf += data })
168-
.on('end', function () {
169-
assert.equal(buf, testfile)
159+
if (isNode) {
160+
var buf = ''
161+
res
162+
.on('error', function (err) { throw err })
163+
.on('data', function (data) { buf += data })
164+
.on('end', function () {
165+
assert.equal(buf, testfile)
166+
done()
167+
})
168+
} else {
169+
if (typeof res === 'string') {
170+
// Just a string
171+
assert.equal(res, testfile)
170172
done()
171-
})
173+
return
174+
}
175+
}
172176
})
173177
})
174178
})

0 commit comments

Comments
 (0)