Merge pull request #1577 from shackbarth/incidenttest
authorLinda Nichols <lynnaloo@gmail.com>
Wed, 11 Jun 2014 19:04:08 +0000 (15:04 -0400)
committerLinda Nichols <lynnaloo@gmail.com>
Wed, 11 Jun 2014 19:04:08 +0000 (15:04 -0400)
test incident status business logic

enyo-client/application/source/models/incident.js
test/lib/runner_engine.js
test/lib/zombie_auth.js
test/specs/incident.js

index ed53521..df7bc72 100644 (file)
@@ -161,7 +161,9 @@ white:true*/
     },
 
     assignedToDidChange: function (model, value, options) {
-      if (value) { this.set('status', XM.Incident.ASSIGNED); }
+      if (value) {
+        this.set('status', XM.Incident.ASSIGNED);
+      }
     },
 
     validate: function () {
index c206592..8608927 100644 (file)
@@ -26,7 +26,9 @@ require:true, __dirname:true, console:true */
 
     var spec = specContents.spec;
 
-    (spec.skipAll ? describe.skip : describe)(spec.recordType, function () {
+    describe(spec.recordType + " test", function () {
+      this.pending = spec.skipAll;
+
       if (_.isString(spec.updatableField)) {
         spec.updateHash = {};
         spec.updateHash[spec.updatableField] = "Test" + Math.random();
index e05558f..a3b3790 100644 (file)
@@ -112,7 +112,7 @@ Simplest possible usage:
 
     zombie.visit(host, {debug: verboseMode}, function (e, browser) {
       if (e) {
-        console.log("Zombie visit error: ", e);
+        //console.log("Zombie visit error: ", e);
       }
       //
       // This is the login screen
index 8744d0e..509d231 100644 (file)
@@ -26,7 +26,7 @@ setTimeout:true, before:true, clearTimeout:true, exports:true, it:true, describe
     @property {String} status [required, default: New](Specify a system-defined Incident status to assign to the Incident from the available options)
     @property {IncidentResolution} resolution (Specify a user-defined Resolution to assign the Incident)
     @property {IncidentSeverity} severity (Specify a user-defined Severity to assign the Incident)
-    @property {UserAccount} owner 
+    @property {UserAccount} owner
     @property {Employee}  assignedTo (Specify the user you want to assign the Incident to)
     @property {String} notes (This is a scrolling text field with word-wrapping for entering general Notes related to the Incident. When a Note is entered, the content of the Note will also automatically be inserted as a Comment on the Incident. The Comment created this way may not be edited; however, if you edit the Note, the associated Comment will include your edits)
     @property {Item} item (Use the field to link an Incident to a specific Item or Lot/Serial Number)
@@ -36,7 +36,7 @@ setTimeout:true, before:true, clearTimeout:true, exports:true, it:true, describe
     @property {IncidentAlarm} alarms ()
     @property {IncidentAccount} accounts
     @property {IncidentComment} comments (To view system-generated Comments associated with an Incident or to add new Comments of your own. select the "Comments" tab)
-    @property {IncidentCharacterisitic} characterisitcs 
+    @property {IncidentCharacterisitic} characterisitcs
     @property {IncidentContact} contacts
     @property {IncidentIncident} incidents
     @property {IncidentOpportunity} opportunities
@@ -74,7 +74,7 @@ setTimeout:true, before:true, clearTimeout:true, exports:true, it:true, describe
     "contacts", "items", "files", "urls", "accounts", "incidents", "uuid", "opportunities",
     "toDos", "toDoRelations", "project", "projects", "customers"],
     requiredAttributes: ["description", "status", "created", "category", "account", "contact",
-    "number"], 
+    "number"],
     /**
       @member Setup
       @memberof Incident
@@ -108,13 +108,28 @@ setTimeout:true, before:true, clearTimeout:true, exports:true, it:true, describe
     }
   };
   var additionalTests = function () {
+    describe("Incident status behavior", function () {
+      var incidentModel;
+
+      beforeEach(function () {
+        incidentModel = new XM.Incident();
+        incidentModel.initialize(null, {isNew: true});
+      });
+      it("Incident status starts out as new", function () {
+        assert.equal(incidentModel.get("status"), XM.Incident.NEW);
+      });
+      it("Incident status gets set to assigned when user is assigned to it", function () {
+        incidentModel.set("assignedTo", new XM.UserAccountRelation());
+        assert.equal(incidentModel.get("status"), XM.Incident.ASSIGNED);
+      });
+    });
     /**
     @member Privileges
     @memberof Incident
     @description Users with "ViewPersonalIncidents" privilege can read their personal Incidents
-    but cannot read the contact's owned by other users. Users with "MaintainPersonalIncidents" 
+    but cannot read the contact's owned by other users. Users with "MaintainPersonalIncidents"
     privilege can create and update their personal Incidents but not the Incidents owned
-    by other users 
+    by other users
     */
     it.skip("Users with \"ViewPersonalIncidents\" privilege can read their personal Incidents" +
       "but cannot read the Incidents owned by other users. ", function () {
@@ -188,7 +203,7 @@ setTimeout:true, before:true, clearTimeout:true, exports:true, it:true, describe
     @description Contacts search should display only contacts related to the specific account, if
     account is already selected
     */
-    it.skip("History panel should be available which displays the Incident history", function () {
+    it.skip("Contacts search should display only contacts related to the specific account", function () {
     });
     /**
     @member Other
@@ -196,9 +211,9 @@ setTimeout:true, before:true, clearTimeout:true, exports:true, it:true, describe
     @description Characteristics Drop down list should display the characteristics assigned to the
      Incidents
     */
-    it.skip("History panel should be available which displays the Incident history", function () {
+    it.skip("Characteristics Drop down list should display incident characteristics", function () {
     });
   };
   exports.spec = spec;
   exports.additionalTests = additionalTests;
-}());
\ No newline at end of file
+}());