test incident status business logic
authorSteve Hackbarth <stephenhackbarth@gmail.com>
Tue, 10 Jun 2014 19:28:39 +0000 (15:28 -0400)
committerSteve Hackbarth <stephenhackbarth@gmail.com>
Tue, 10 Jun 2014 19:28:39 +0000 (15:28 -0400)
test/lib/runner_engine.js
test/specs/incident.js

index c206592..6be282e 100644 (file)
@@ -26,7 +26,7 @@ require:true, __dirname:true, console:true */
 
     var spec = specContents.spec;
 
-    (spec.skipAll ? describe.skip : describe)(spec.recordType, function () {
+    (spec.skipAll ? describe.skip : describe)(spec.recordType + " test", function () {
       if (_.isString(spec.updatableField)) {
         spec.updateHash = {};
         spec.updateHash[spec.updatableField] = "Test" + Math.random();
index 8744d0e..cca4560 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,31 @@ setTimeout:true, before:true, clearTimeout:true, exports:true, it:true, describe
     }
   };
   var additionalTests = function () {
+    describe("Incident status behavior", function () {
+      var incidentModel;
+
+      beforeEach(function (done) {
+        incidentModel = new XM.Incident();
+        incidentModel.once("status:READY_NEW", function () {
+          done();
+        });
+        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 +206,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 +214,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
+}());