it('should be able to accept valid formed array', () => { should.throws(() => new Matrix(), TypeError); should.throws(() => new Matrix([]), TypeError); should.throws(() => new Matrix([ [], {} ]), TypeError); should.throws(() => new Matrix([ [ 1, 2 ], [ 3 ] ]), TypeError); should.throws(() => new Matrix([ [ 1, 2 ], [ 3, '4' ] ]), TypeError); });
it('should throw', () => { should.throws(() => { m1.validate({ field: ' ' }) }) should.throws(() => { m2.validate({ field: ' ' }) }) })
it('[issue #1] bug: Number type is not strict', () => { should.throws(() => { bug1_a.validate({ number: '1.2a' }) }) should.throws(() => { bug1_b.validate({ integer: '5.2a' }) }) })
it('should throw for bad date', function() { should.throws(function () { MockDate.set('40/40/2000'); }, 'mockdate: The time set is an invalid date: 40/40/2000'); should.throws(function () { MockDate.set(NaN); }, 'mockdate: The time set is an invalid date: NaN'); });
it('must be defined default and variants', function() { should.throws(function(){ m.matchStrict('a') }); should.throws(function(){ m.matchStrict('a', {}) }); should.doesNotThrow(function(){ m.matchStrict('a', {}, null); }) });
it('should throw an exception if passed in a empty timeout', function () { should.throws(function () { consumerGroup.scheduleReconnect(0); }); should.throws(function () { consumerGroup.scheduleReconnect(null); }); should.throws(function () { consumerGroup.scheduleReconnect(undefined); }); });
it('should throw if required options are missing', function () { resetMocks(); should.throws(function () { api.getElement({project: 1, page: 1, element: 1}, function () {}); }); should.throws(function () { api.getElement({user: 1, page: 1, element: 1}, function () {}); }); should.throws(function () { api.getElement({user: 1, project: 1, element: 1}, function () {}); }); should.throws(function () { api.getElement({user: 1, project: 1, page: 1}, function () {}); }); });
it('should fail when attempting to load from a file that does not exist', function() { var emptyConfigFileFunction = function() { var config = new NoZConfig(); config.loadPropertiesFromFile('config/', 'thisfiledoenotexist.properties'); }; assert.throws(emptyConfigFileFunction, Error, "ENOENT"); });
it('should throw an error if the referenced middleware file can\'t be found', function (done) { var mware = middleware('MISSING', { "middlewarePath": path.join(__dirname, '../app/middleware') }); var file = mware.loadEvent; should.throws(function() { mware.load() } ); done(); })
it('should throw error for invalid configuration', function() { should.throws(function() { validator.validate({ direction: 'invalid' }); }); });
it('Invalid', function () { should.throws(function () { JoiFunc(schema, function (n, s) { return 'lalala' })(10, 'abc') }, shouldError('Invalid return: "value" must be a boolean: lalala')) })
it('Invalid', function () { should.throws(function () { JoiFunc(schema, function (n, s) { throw new Error('Never be thrown') })(10, 123) }, shouldError('Invalid argument: "value" must be a string: 123')) })
it('Less', function () { should.throws(function () { JoiFunc(schema, function (n, s) { throw new Error('Never be thrown') })() }, shouldError('Too less arguments passed to function')) })
function throwTest (f) { var params = slice.call(arguments, 1); should.throws(function () { f.apply(null, params); }); }
it('rejects non-object', function (done) { should.throws(function () { var g = new GDS(''); }); done(); });
it('should throw TypeError with null predicate', function() { should.throws(function() { utils.find_first([1, 2, 3], null); }, function(err) { return err instanceof TypeError; }); });
it('should throw TypeError with null array parameter', function() { should.throws(function() { utils.find_first(null, function() {}); }, function(err) { return err instanceof TypeError; }); });
it('[issue #5] bug: Number type accepts blank values', () => { should.throws(() => { bug1_a.validate({ number: '' }) }) should.throws(() => { bug1_b.validate({ integer: '' }) }) should.throws(() => { bug1_a.validate({ number: null }) }) should.throws(() => { bug1_b.validate({ integer: null }) }) bug1_a.validate({ number: 0 }).should.deepEqual({ number: 0 }) bug1_b.validate({ integer: 0 }).should.deepEqual({ integer: 0 }) })
it('should throw an exception trying to create a new site with an invalid uri', () => { should.throws(() => { /* eslint-disable no-new */ new TargetSite(INVALID_URI); /* eslint-enable no-new */ }); });
it('should throw if route can not be parsed', function () { should.throws(function () { routing.createRouter({ myController1: { 'post bla &': function () {} } }); }); });
it('should Model.find when only function passed', function () { should.throws( function () { AppModel.find(function () {}) } ) })
it('should Model.find when empty options passed', function () { should.throws( function () { AppModel.find(null, function () {}) } ) })
it('should throw an exception trying to create a new SonyENSSite with an incorrect uri', () => { should.throws(() => { /* eslint-disable no-new */ new SonyENSSite(INVALID_URI); /* eslint-enable no-new */ }); });
function validateThrowsInvalidConfigError (groupId) { should.throws(function () { var client = new FakeClient(); // eslint-disable-next-line no-new new HighLevelConsumer(client, [ { topic: 'some_topic' } ], {groupId: groupId}); }, InvalidConfigError); }
it('should throw error on invalid address', function() { var addr = 'invalid://localhost'; should.throws(function() { u.parseAddress(addr); }, Error, 'Should validate protocol'); addr = 'amqp://host:non-numeric'; should.throws(function() { u.parseAddress(addr); }, Error, 'Should validate port'); addr = 'amqp://host:123:what-is-this?'; should.throws(function() { u.parseAddress(addr); }, Error, 'Bad regex match'); });
it('should be unable to enlage when not an object provided', () => { const testObject = {}; should.throws(() => { testObject.enlarge('string'); }, TypeError); });
it('returns a new error with errors', function () { var fn = function () { throw new TypeError('type error'); }; should.throws(function () { target(fn); }, Error); });
it('58.1.23 Negative - externalAuth', function() { should.throws( function() { oracledb.externalAuth = 2017; }, /NJS-004: invalid value for property [\w]/ ); });
it('58.1.30 Negative - events', function() { should.throws( function() { oracledb.events = 'hello'; }, /NJS-004: invalid value for property events/ ); });
it('58.1.28 Negative - edition', function() { should.throws( function() { oracledb.edition = 123; }, /NJS-004: invalid value for property edition/ ); });