Skip to content

Commit

Permalink
fix: Detect memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Jan 23, 2020
1 parent 95efe31 commit 7683bec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/connect.js
Expand Up @@ -333,8 +333,6 @@ test('reject clients with wrong protocol name', function (t) {
})

test('After first CONNECT Packet, others are queued until \'connect\' event', function (t) {
t.plan(2)

var broker = aedes()

var publishP = {
Expand All @@ -357,12 +355,14 @@ test('After first CONNECT Packet, others are queued until \'connect\' event', fu
var s = setup(broker, false)
s.inStream.write(connectP)

for (let i = 0; i < 10; i++) {
process.once('warning', e => t.fail('Memory leak detected'))

for (let i = 0; i < 100; i++) {
s.inStream.write(publishP)
}

broker.on('client', function (client) {
t.equal(client.parser._queue.length, 10, 'Packets have been queued')
t.equal(client.parser._queue.length, 100, 'Packets have been queued')

client.once('connected', () => {
t.equal(client.parser._queue, null, 'Queue is empty')
Expand Down

0 comments on commit 7683bec

Please sign in to comment.