Code coverage report for api/user/Team.js

Statements: 60.87% (14 / 23)      Branches: 30% (3 / 10)      Functions: 66.67% (4 / 6)      Lines: 60.87% (14 / 23)      Ignored: none     

All files » api/user/ » Team.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 1031                     1 22 22   22 22     1             45     1     1 1   1                                                           1                                                                       1  
var UserMask = require("./UserMask").UserMask;
 
/**
 *
 * @class Team extends from UserMask. It inherits the same attributes as UserMask but can
 * login.
 *
 * @name  Team
 * @extends UserMask
 * @constructs
 */
var Team = function Team(options) {
  Eif (!this._fieldDBtype) {
    this._fieldDBtype = "Team";
  }
  this.debug("Constructing Team: ", options);
  UserMask.apply(this, arguments);
};
 
Team.prototype = Object.create(UserMask.prototype, /** @lends Team.prototype */ {
  constructor: {
    value: Team
  },
 
  id: {
    get: function() {
      return "team";
    },
    set: function(value) {
      Iif (value === this._id) {
        return;
      }
      Eif (value !== "team") {
        this.warn("Cannot set team id to anything other than \"team.\"");
      }
      this._id = "team";
    }
  },
 
  defaults: {
    value: {
      // Defaults from UserMask
      username: "",
      password: "",
      email: "",
      gravatar: "",
      researchInterest: "",
      affiliation: "",
      description: "",
      subtitle: "",
      datalists: [],
      mostRecentIds: {},
      // Defaults from User
      firstname: "",
      lastname: "",
      teams: [],
      sessionHistory: []
    }
  },
 
  /**
   * The subtitle function returns user's first and last names.
   */
  subtitle: {
    get: function() {
      return this.name;
    },
    set: function(value) {
      if (value === this.name) {
        return;
      }
      this.warn("subtitle is deprecated, use name instead.");
      this.name = value;
    }
  },
 
  merge: {
    value: function(callOnSelf, anotherObject, optionalOverwriteOrAsk) {
      this.debug("Customizing merge ", callOnSelf);
      if (anotherObject.id) {
        anotherObject.id = "";
      }
      return UserMask.prototype.merge.apply(this, [callOnSelf, anotherObject, optionalOverwriteOrAsk]);
    }
  }
 
  // toJSON: {
  //   value: function(includeEvenEmptyAttributes, removeEmptyAttributes) {
  //     this.debug("Customizing toJSON ", includeEvenEmptyAttributes, removeEmptyAttributes);
  //     var json = UserMask.prototype.toJSON.apply(this, [false, true]);
  //     json._id = this.id;
  //     delete json.fieldDBtype;
  //     delete json.version;
  //     delete json.api;
  //     this.debug(json);
  //     return json;
  //   }
  // }
 
});
 
exports.Team = Team;