Skip to content

Commit

Permalink
test: let the responsibility to beforeEachExec method of closing the …
Browse files Browse the repository at this point in the history
…open connections
  • Loading branch information
MaximoLiberata committed Aug 2, 2024
1 parent 8d154b0 commit f70e825
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions test/abstract_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,6 @@ export default function abstractTest(server, config, ports) {
process.nextTick(() => {
assert.strictEqual(spy.callCount, 1)
client.end(true, done)
client = null
})
}
})
Expand Down Expand Up @@ -2248,10 +2247,6 @@ export default function abstractTest(server, config, ports) {

t.after(() => {
clock.restore()
if (client) {
client.end(true)
throw new Error('Test timed out')
}
})

const options: IClientOptions = {
Expand All @@ -2267,7 +2262,6 @@ export default function abstractTest(server, config, ports) {
client.once('connect', () => {
client.end(true, done)
clock.tick(100)
client = null
})
})

Expand All @@ -2292,9 +2286,6 @@ export default function abstractTest(server, config, ports) {

t.after(() => {
clock.restore()
if (client) {
client.end(true)
}
})

let client = connect({ keepalive: 10 })

Check failure on line 2291 in test/abstract_client.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

'client' is never reassigned. Use 'const' instead
Expand All @@ -2316,7 +2307,6 @@ export default function abstractTest(server, config, ports) {
client.removeAllListeners('close')
client.end(true, done)
clock.tick(100)
client = null
}
})

Expand Down Expand Up @@ -3309,12 +3299,6 @@ export default function abstractTest(server, config, ports) {
timeout: 4000,
},
function _test(t, done) {
t.after(() => {
// close client if not closed
if (client) {
client.end(true)
}
})
let client = connect({ reconnectPeriod: 200 })

Check failure on line 3302 in test/abstract_client.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

'client' is never reassigned. Use 'const' instead
let serverPublished = false
let clientCalledBack = false
Expand Down Expand Up @@ -3352,7 +3336,6 @@ export default function abstractTest(server, config, ports) {
setImmediate(() => {
assert.isTrue(clientCalledBack)
client.end(true, done)
client = null
})
}
})
Expand Down Expand Up @@ -3391,13 +3374,6 @@ export default function abstractTest(server, config, ports) {
timeout: 4000,
},
function _test(t, done) {
t.after(() => {
// close client if not closed
if (client) {
client.end(true)
}
})

let client = connect({ reconnectPeriod: 200 })

Check failure on line 3377 in test/abstract_client.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

'client' is never reassigned. Use 'const' instead
let serverPublished = false
let clientCalledBack = false
Expand Down Expand Up @@ -3428,21 +3404,13 @@ export default function abstractTest(server, config, ports) {
setImmediate(() => {
assert.isTrue(clientCalledBack)
client.end(true, done)
client = null
})
}
})
},
)

it('should not resend in-flight QoS 1 removed publish messages from the client', function _test(t, done) {
t.after(() => {
// close client if not closed
if (client) {
client.end(true)
}
})

let client = connect({ reconnectPeriod: 100 })

Check failure on line 3414 in test/abstract_client.ts

View workflow job for this annotation

GitHub Actions / build (20.x)

'client' is never reassigned. Use 'const' instead
let clientCalledBack = false

Expand Down Expand Up @@ -3477,7 +3445,6 @@ export default function abstractTest(server, config, ports) {
assert.isTrue(clientCalledBack)
client.end(true, (err) => {
done(err)
client = null
})
})

Expand Down

0 comments on commit f70e825

Please sign in to comment.