Skip to content

Commit 4a3e6e7

Browse files
author
Ruben Bridgewater
committed
Lower test run time
1 parent c50cf5f commit 4a3e6e7

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

test/parsers.spec.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ describe('parsers', function () {
141141
'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ' +
142142
'ut aliquip ex ea commodo consequat. Duis aute irure dolor in' // 256 chars
143143
var bigStringArray = (new Array(Math.pow(2, 16) / lorem.length).join(lorem + ' ')).split(' ') // Math.pow(2, 16) chars long
144-
var startBigBuffer = new Buffer(str + '$' + (size) + '\r\n')
144+
var startBigBuffer = new Buffer(str + '$' + size + '\r\n')
145145
var parts = size / 65536
146146
var chunks = new Array(parts)
147147
parser.execute(startBigBuffer)
@@ -196,15 +196,13 @@ describe('parsers', function () {
196196
createBufferOfSize(parser, size * 11)
197197
createBufferOfSize(parser, size, '\r\n')
198198
parser.execute(new Buffer('\r\n'))
199-
setTimeout(function () {
200-
done()
201-
}, 500)
199+
setTimeout(done, 425)
202200
})
203201

204202
it('multiple parsers do not interfere', function () {
205203
var results = [1234567890, 'foo bar baz', 'hello world']
206204
function checkReply (reply) {
207-
assert.strictEqual(results[replyCount], reply)
205+
assert.strictEqual(reply, results[replyCount])
208206
replyCount++
209207
}
210208
var parserOne = newParser(checkReply)
@@ -224,7 +222,7 @@ describe('parsers', function () {
224222
it('multiple parsers do not interfere with bulk strings in arrays', function () {
225223
var results = [['foo', 'foo bar baz'], [1234567890, 'hello world', 'the end'], 'ttttttttttttttttttttttttttttttttttttttttttttttt']
226224
function checkReply (reply) {
227-
assert.deepEqual(results[replyCount], reply)
225+
assert.deepEqual(reply, results[replyCount])
228226
replyCount++
229227
}
230228
var parserOne = newParser(checkReply)
@@ -273,7 +271,7 @@ describe('parsers', function () {
273271
var bigString = (new Array(Math.pow(2, 17) / lorem.length + 1).join(lorem)) // Math.pow(2, 17) chars long
274272
var sizes = [4, Math.pow(2, 17)]
275273
function checkReply (reply) {
276-
assert.strictEqual(sizes[replyCount], reply.length)
274+
assert.strictEqual(reply.length, sizes[replyCount])
277275
replyCount++
278276
}
279277
var parser = newParser(checkReply)
@@ -690,14 +688,14 @@ describe('parsers', function () {
690688
assert.strictEqual(replyCount, 3)
691689
parser.execute(new Buffer('\r\n'))
692690
assert.strictEqual(replyCount, 4)
693-
}, 25)
691+
}, 20)
694692
// Delay done so the bufferPool is cleared and tested
695693
// If the buffer is not cleared, the coverage is not going to be at 100
696694
setTimeout(function () {
697695
var totalBuffer = Buffer.concat(chunks).toString()
698696
assert.strictEqual(replies[3].toString(), totalBuffer)
699697
done()
700-
}, (jsParser ? 1400 : 50))
698+
}, (jsParser ? 1400 : 40))
701699
})
702700

703701
it('handle big data', function () {
@@ -714,7 +712,7 @@ describe('parsers', function () {
714712

715713
it('handle big data 2 with buffers', function (done) {
716714
this.timeout(7500)
717-
var size = 120 * 1024 * 1024
715+
var size = 111.5 * 1024 * 1024
718716
var replyLen = [size, size * 2, 11, 11]
719717
function checkReply (reply) {
720718
assert.strictEqual(reply.length, replyLen[replyCount])
@@ -732,7 +730,7 @@ describe('parsers', function () {
732730
parser.execute(new Buffer(' buffer\r\n'))
733731
assert.strictEqual(replyCount, 4)
734732
done()
735-
}, 75)
733+
}, 60)
736734
})
737735
})
738736
})

0 commit comments

Comments
 (0)