Skip to content

Commit 45e623f

Browse files
committed
Improve test coverage
1 parent 3a4d845 commit 45e623f

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

test/node-test/agent.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -773,13 +773,20 @@ test('stream: fails with invalid onInfo', async (t) => {
773773
}
774774
})
775775

776-
test('constructor validations', t => {
777-
const p = tspl(t, { plan: 5 })
776+
test('Agent constructor validations', t => {
777+
const p = tspl(t, { plan: 3 })
778778
p.throws(() => new Agent({ factory: 'ASD' }), errors.InvalidArgumentError, 'throws on invalid opts argument')
779779
p.throws(() => new Agent({ maxOrigins: -1 }), errors.InvalidArgumentError, 'maxOrigins must be a number greater than 0')
780780
p.throws(() => new Agent({ maxOrigins: 'foo' }), errors.InvalidArgumentError, 'maxOrigins must be a number greater than 0')
781-
p.throws(() => new Pool({ maxFree: -1 }), errors.InvalidArgumentError, 'maxFree must be a number greater than 0')
782-
p.throws(() => new Pool({ maxFree: 'foo' }), errors.InvalidArgumentError, 'maxFree must be a number greater than 0')
781+
})
782+
783+
test('Pool constructor validatons', t => {
784+
const p = tspl(t, { plan: 5 })
785+
p.throws(() => new Pool({ connections: 'ASD' }), errors.InvalidArgumentError, 'throws on non-number')
786+
p.throws(() => new Pool({ connect: 'ASD' }), errors.InvalidArgumentError, 'throws if not a function or object')
787+
p.throws(() => new Pool({ factory: 'ASD' }), errors.InvalidArgumentError, 'throws on non-function')
788+
p.throws(() => new Pool({ maxFree: -1 }), errors.InvalidArgumentError, 'throws on negative number')
789+
p.throws(() => new Pool({ maxFree: 'foo' }), errors.InvalidArgumentError, 'throws on non-number')
783790
})
784791

785792
test('dispatch validations', async t => {

0 commit comments

Comments
 (0)