diff --git a/test/unit/test-interval.js b/test/unit/test-interval.js index fbda5ef..ac6ffac 100644 --- a/test/unit/test-interval.js +++ b/test/unit/test-interval.js @@ -17,39 +17,39 @@ describe('keep-alive interval', () => { it('should validate passed arguments', function () { ;(() => Lib.setKeepAliveInterval()).should.throw( - 'setKeepAliveInterval requires two arguments' + /^setKeepAliveInterval requires two arguments/ ) ;(() => Lib.setKeepAliveInterval('')).should.throw( - 'setKeepAliveInterval requires two arguments' + /^setKeepAliveInterval requires two arguments/ ) ;(() => Lib.setKeepAliveInterval('', '', '')).should.throw( - 'setKeepAliveInterval requires two arguments' + /^setKeepAliveInterval requires two arguments/ ) ;(() => Lib.setKeepAliveInterval(null, 1)).should.throw( - 'setKeepAliveInterval expects an instance of socket as its first argument' + /^setKeepAliveInterval expects an instance of socket as its first argument/ ) ;(() => Lib.setKeepAliveInterval({}, 1)).should.throw( - 'setKeepAliveInterval expects an instance of socket as its first argument' + /^setKeepAliveInterval expects an instance of socket as its first argument/ ) ;(() => Lib.setKeepAliveInterval(new (class {})(), 1)).should.throw( - 'setKeepAliveInterval expects an instance of socket as its first argument' + /^setKeepAliveInterval expects an instance of socket as its first argument/ ) ;(() => Lib.setKeepAliveInterval(new Stream.PassThrough(), 1)).should.throw( - 'setKeepAliveInterval expects an instance of socket as its first argument' + /^setKeepAliveInterval expects an instance of socket as its first argument/ ) const socket = new Net.Socket() ;(() => Lib.setKeepAliveInterval(socket, null)).should.throw( - 'setKeepAliveInterval requires msec to be a Number' + /^setKeepAliveInterval requires msec to be a Number/ ) ;(() => Lib.setKeepAliveInterval(socket, '')).should.throw( - 'setKeepAliveInterval requires msec to be a Number' + /^setKeepAliveInterval requires msec to be a Number/ ) ;(() => Lib.setKeepAliveInterval(socket, true)).should.throw( - 'setKeepAliveInterval requires msec to be a Number' + /^setKeepAliveInterval requires msec to be a Number/ ) ;(() => Lib.setKeepAliveInterval(socket, {})).should.throw( - 'setKeepAliveInterval requires msec to be a Number' + /^setKeepAliveInterval requires msec to be a Number/ ) }) diff --git a/test/unit/test-probes.js b/test/unit/test-probes.js index 4e31e31..bd2e644 100644 --- a/test/unit/test-probes.js +++ b/test/unit/test-probes.js @@ -17,39 +17,39 @@ describe('keep-alive probes', () => { it('should validate passed arguments', function () { ;(() => Lib.setKeepAliveProbes()).should.throw( - 'setKeepAliveProbes requires two arguments' + /^setKeepAliveProbes requires two arguments/ ) ;(() => Lib.setKeepAliveProbes('')).should.throw( - 'setKeepAliveProbes requires two arguments' + /^setKeepAliveProbes requires two arguments/ ) ;(() => Lib.setKeepAliveProbes('', '', '')).should.throw( - 'setKeepAliveProbes requires two arguments' + /^setKeepAliveProbes requires two arguments/ ) ;(() => Lib.setKeepAliveProbes(null, 1)).should.throw( - 'setKeepAliveProbes expects an instance of socket as its first argument' + /^setKeepAliveProbes expects an instance of socket as its first argument/ ) ;(() => Lib.setKeepAliveProbes({}, 1)).should.throw( - 'setKeepAliveProbes expects an instance of socket as its first argument' + /^setKeepAliveProbes expects an instance of socket as its first argument/ ) ;(() => Lib.setKeepAliveProbes(new (class {})(), 1)).should.throw( - 'setKeepAliveProbes expects an instance of socket as its first argument' + /^setKeepAliveProbes expects an instance of socket as its first argument/ ) ;(() => Lib.setKeepAliveProbes(new Stream.PassThrough(), 1)).should.throw( - 'setKeepAliveProbes expects an instance of socket as its first argument' + /^setKeepAliveProbes expects an instance of socket as its first argument/ ) const socket = new Net.Socket() ;(() => Lib.setKeepAliveProbes(socket, null)).should.throw( - 'setKeepAliveProbes requires cnt to be a Number' + /^setKeepAliveProbes requires cnt to be a Number/ ) ;(() => Lib.setKeepAliveProbes(socket, '')).should.throw( - 'setKeepAliveProbes requires cnt to be a Number' + /^setKeepAliveProbes requires cnt to be a Number/ ) ;(() => Lib.setKeepAliveProbes(socket, true)).should.throw( - 'setKeepAliveProbes requires cnt to be a Number' + /^setKeepAliveProbes requires cnt to be a Number/ ) ;(() => Lib.setKeepAliveProbes(socket, {})).should.throw( - 'setKeepAliveProbes requires cnt to be a Number' + /^setKeepAliveProbes requires cnt to be a Number/ ) }) diff --git a/test/unit/test-timeout.js b/test/unit/test-timeout.js index c3f1a0f..6876e28 100644 --- a/test/unit/test-timeout.js +++ b/test/unit/test-timeout.js @@ -18,39 +18,39 @@ describe('TCP User Timeout', () => { itSkipOS( ['freebsd'],'should validate passed arguments', function () { ;(() => Lib.setUserTimeout()).should.throw( - 'setUserTimeout requires two arguments' + /^setUserTimeout requires two arguments/ ) ;(() => Lib.setUserTimeout('')).should.throw( - 'setUserTimeout requires two arguments' + /^setUserTimeout requires two arguments/ ) ;(() => Lib.setUserTimeout('', '', '')).should.throw( - 'setUserTimeout requires two arguments' + /^setUserTimeout requires two arguments/ ) ;(() => Lib.setUserTimeout(null, 1)).should.throw( - 'setUserTimeout expects an instance of socket as its first argument' + /^setUserTimeout expects an instance of socket as its first argument/ ) ;(() => Lib.setUserTimeout({}, 1)).should.throw( - 'setUserTimeout expects an instance of socket as its first argument' + /^setUserTimeout expects an instance of socket as its first argument/ ) ;(() => Lib.setUserTimeout(new (class {})(), 1)).should.throw( - 'setUserTimeout expects an instance of socket as its first argument' + /^setUserTimeout expects an instance of socket as its first argument/ ) ;(() => Lib.setUserTimeout(new Stream.PassThrough(), 1)).should.throw( - 'setUserTimeout expects an instance of socket as its first argument' + /^setUserTimeout expects an instance of socket as its first argument/ ) const socket = new Net.Socket() ;(() => Lib.setUserTimeout(socket, null)).should.throw( - 'setUserTimeout requires msec to be a Number' + /^setUserTimeout requires msec to be a Number/ ) ;(() => Lib.setUserTimeout(socket, '')).should.throw( - 'setUserTimeout requires msec to be a Number' + /^setUserTimeout requires msec to be a Number/ ) ;(() => Lib.setUserTimeout(socket, true)).should.throw( - 'setUserTimeout requires msec to be a Number' + /^setUserTimeout requires msec to be a Number/ ) ;(() => Lib.setUserTimeout(socket, {})).should.throw( - 'setUserTimeout requires msec to be a Number' + /^setUserTimeout requires msec to be a Number/ ) })