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

Commit 0e4b960

Browse files
committed
test: fix, bring back isPong
1 parent 10d77c8 commit 0e4b960

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

js/src/ping/ping-pull-stream.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const pull = require('pull-stream')
55
const series = require('async/series')
66
const { spawnNodesWithId } = require('../utils/spawn')
77
const { getDescribe, getIt, expect } = require('../utils/mocha')
8+
const { isPong } = require('./utils.js')
89
const { connect } = require('../utils/swarm')
910

1011
module.exports = (createCommon, options) => {
@@ -13,7 +14,7 @@ module.exports = (createCommon, options) => {
1314
const common = createCommon()
1415

1516
describe('.pingPullStream', function () {
16-
this.timeout(35 * 1000)
17+
this.timeout(40 * 1000)
1718

1819
let ipfsA
1920
let ipfsB
@@ -48,9 +49,9 @@ module.exports = (createCommon, options) => {
4849
pull.drain((res) => {
4950
expect(res.success).to.be.true()
5051
// It's a pong
51-
// if (isPong(res)) { TODO understand why this was here, it was not defined
52-
// packetNum++
53-
// }
52+
if (isPong(res)) {
53+
packetNum++
54+
}
5455
}, (err) => {
5556
expect(err).to.not.exist()
5657
expect(packetNum).to.equal(count)

js/src/ping/ping-readable-stream.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const { Writable } = require('stream')
66
const series = require('async/series')
77
const { spawnNodesWithId } = require('../utils/spawn')
88
const { getDescribe, getIt, expect } = require('../utils/mocha')
9+
const { isPong } = require('./utils.js')
910
const { connect } = require('../utils/swarm')
1011

1112
module.exports = (createCommon, options) => {
@@ -52,9 +53,9 @@ module.exports = (createCommon, options) => {
5253
write (res, enc, cb) {
5354
expect(res.success).to.be.true()
5455
// It's a pong
55-
// if (isPong(res)) { // TODO understand why this was here, not defined before
56-
// packetNum++
57-
// }
56+
if (isPong(res)) {
57+
packetNum++
58+
}
5859

5960
cb()
6061
}

js/src/ping/ping.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = (createCommon, options) => {
1313
const common = createCommon()
1414

1515
describe('.ping', function () {
16-
this.timeout(35 * 1000)
16+
this.timeout(40 * 1000)
1717

1818
let ipfsA
1919
let ipfsB

0 commit comments

Comments
 (0)