Horje
test function that call a function javascrip Code Example
test function that call a function javascrip
it('should call the module bar immediately', function () {
  var barSpy = expect.spyOn(Foo.prototype, 'barModule');

  new Foo();

  expect(barSpy).toHaveBeenCalled();    
});
test function that call a function javascrip
var _ = require('lodash');

var Foo = module.exports = function (config) {

  this.config = _.merge({
      role: 'user',
      x: '123',
      y: '321'
    },
    config);

  this.config.role = validateRole(this.config.role);
};

var validateRole = function (role) {
  var roles = [
    'user', 'editor', 'admin'
  ];

  if (_.contains(roles, role)) {
    return role;
  } else {
    return 'user'
  }
};
test function that call a function javascrip
var bar = require('./bar');

var Foo = module.exports = function () {
  this.bar();
  this.barModule();
};
Foo.prototype.bar = function () {};
Foo.prototype.barModule = bar; // setting here as barModule




Java

Related
@override java example Code Example @override java example Code Example
are inner classes inherited Code Example are inner classes inherited Code Example
bucle for java Code Example bucle for java Code Example
how to know what a valid name for a variable is in java Code Example how to know what a valid name for a variable is in java Code Example
isnull java Code Example isnull java Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11