Example #1
0
 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);
 });
Example #2
0
 it('should throw', () => {
   should.throws(() => {
     m1.validate({ field: ' ' })
   })
   should.throws(() => {
     m2.validate({ field: ' ' })
   })
 })
Example #3
0
 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' })
   })
 })
Example #4
0
  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');
  });
Example #5
0
 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);
   })
 });
Example #6
0
    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);
      });
    });
Example #7
0
 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");
 });
Example #9
0
  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();
  })
Example #10
0
 it('should throw error for invalid configuration', function() {
     should.throws(function() {
         validator.validate({
             direction: 'invalid'
         });
     });
 });
Example #11
0
 it('Invalid', function () {
     should.throws(function () {
         JoiFunc(schema, function (n, s) {
             return 'lalala'
         })(10, 'abc')
     }, shouldError('Invalid return: "value" must be a boolean: lalala'))
 })
Example #12
0
 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'))
 })
Example #13
0
 it('Less', function () {
     should.throws(function () {
         JoiFunc(schema, function (n, s) {
             throw new Error('Never be thrown')
         })()
     }, shouldError('Too less arguments passed to function'))
 })
Example #14
0
File: test.js Project: grapily/rext
function throwTest (f) {
  var params = slice.call(arguments, 1);

  should.throws(function () {
    f.apply(null, params);
  });
}
Example #15
0
  it('rejects non-object', function (done) {
    should.throws(function () {
      var g = new GDS('');
    });

    done();
  });
Example #16
0
 it('should throw TypeError with null predicate', function() {
     should.throws(function() {
         utils.find_first([1, 2, 3], null);
     }, function(err) {
         return err instanceof TypeError;
     });
 });
Example #17
0
 it('should throw TypeError with null array parameter', function() {
     should.throws(function() {
         utils.find_first(null, function() {});
     }, function(err) {
         return err instanceof TypeError;
     });
 });
Example #18
0
 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 })
 })
Example #19
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 */
   });
 });
Example #20
0
		it('should throw if route can not be parsed', function () {
			should.throws(function () {
				routing.createRouter({
					myController1: { 'post bla &': function () {} }
				});
			});
		});
Example #21
0
 it('should Model.find when only function passed', function () {
   should.throws(
     function () {
       AppModel.find(function () {})
     }
   )
 })
Example #22
0
 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);
 }
Example #25
0
    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');
    });
Example #26
0
    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);
 });
Example #28
0
 it('58.1.23 Negative - externalAuth', function() {
   should.throws(
     function() {
       oracledb.externalAuth = 2017;
     },
     /NJS-004: invalid value for property [\w]/
   );
 });
Example #29
0
 it('58.1.30 Negative - events', function() {
   should.throws(
     function() {
       oracledb.events = 'hello';
     },
     /NJS-004: invalid value for property events/
   );
 });
Example #30
0
 it('58.1.28 Negative - edition', function() {
   should.throws(
     function() {
       oracledb.edition = 123;
     },
     /NJS-004: invalid value for property edition/
   );
 });