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

Commit bf5bfff

Browse files
committed
clean bitswap tests
1 parent 74ecf1c commit bf5bfff

File tree

1 file changed

+22
-52
lines changed

1 file changed

+22
-52
lines changed

test/bitswap.spec.js

Lines changed: 22 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -26,65 +26,35 @@ describe('.bitswap', function () {
2626

2727
after((done) => ipfsd.stop(done))
2828

29-
describe('Callback API', () => {
30-
it('.wantlist', (done) => {
31-
ipfs.bitswap.wantlist((err, res) => {
32-
expect(err).to.not.exist()
33-
expect(res).to.have.to.be.eql({
34-
Keys: null
35-
})
36-
done()
37-
})
38-
})
39-
40-
it('.stat', (done) => {
41-
ipfs.bitswap.stat((err, res) => {
42-
expect(err).to.not.exist()
43-
expect(res).to.have.property('BlocksReceived')
44-
expect(res).to.have.property('DupBlksReceived')
45-
expect(res).to.have.property('DupDataReceived')
46-
expect(res).to.have.property('Peers')
47-
expect(res).to.have.property('ProvideBufLen')
48-
expect(res).to.have.property('Wantlist')
49-
50-
done()
51-
})
52-
})
53-
54-
it('.unwant', (done) => {
55-
const key = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP'
56-
ipfs.bitswap.unwant(key, (err) => {
57-
expect(err).to.not.exist()
58-
done()
29+
it('.wantlist', (done) => {
30+
ipfs.bitswap.wantlist((err, res) => {
31+
expect(err).to.not.exist()
32+
expect(res).to.have.to.eql({
33+
Keys: null
5934
})
35+
done()
6036
})
6137
})
6238

63-
describe('Promise API', () => {
64-
it('.wantlist', () => {
65-
return ipfs.bitswap.wantlist()
66-
.then((res) => {
67-
expect(res).to.have.to.be.eql({
68-
Keys: null
69-
})
70-
})
71-
})
39+
it('.stat', (done) => {
40+
ipfs.bitswap.stat((err, res) => {
41+
expect(err).to.not.exist()
42+
expect(res).to.have.property('BlocksReceived')
43+
expect(res).to.have.property('DupBlksReceived')
44+
expect(res).to.have.property('DupDataReceived')
45+
expect(res).to.have.property('Peers')
46+
expect(res).to.have.property('ProvideBufLen')
47+
expect(res).to.have.property('Wantlist')
7248

73-
it('.stat', () => {
74-
return ipfs.bitswap.stat()
75-
.then((res) => {
76-
expect(res).to.have.property('BlocksReceived')
77-
expect(res).to.have.property('DupBlksReceived')
78-
expect(res).to.have.property('DupDataReceived')
79-
expect(res).to.have.property('Peers')
80-
expect(res).to.have.property('ProvideBufLen')
81-
expect(res).to.have.property('Wantlist')
82-
})
49+
done()
8350
})
51+
})
8452

85-
it('.unwant', () => {
86-
const key = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP'
87-
return ipfs.bitswap.unwant(key)
53+
it('.unwant', (done) => {
54+
const key = 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP'
55+
ipfs.bitswap.unwant(key, (err) => {
56+
expect(err).to.not.exist()
57+
done()
8858
})
8959
})
9060
})

0 commit comments

Comments
 (0)