3 describe('crmCaseType', function() {
5 beforeEach(function() {
10 'REL_TYPE_CNAME': 'label_b_a'
12 module('crmCaseType');
13 module('crmJsonComparator');
14 inject(function(crmJsonComparator
) {
15 crmJsonComparator
.register(jasmine
);
19 describe('CaseTypeCtrl', function() {
27 beforeEach(inject(function(_
$httpBackend_
, $rootScope
, $controller
, $compile
, $timeout
) {
28 $httpBackend
= _
$httpBackend_
;
29 scope
= $rootScope
.$new();
37 "option_group_id": "25",
50 "option_group_id": "25",
66 "option_group_id": "2",
67 "label": "ADC referral",
69 "name": "ADC referral",
80 "option_group_id": "2",
81 "label": "Add Client To Case",
83 "name": "Add Client To Case",
99 "name_a_b": "Benefits Specialist is",
100 "label_a_b": "Benefits Specialist is",
101 "name_b_a": "Benefits Specialist",
102 "label_b_a": "Benefits Specialist",
103 "description": "Benefits Specialist",
104 "contact_type_a": "Individual",
105 "contact_type_b": "Individual",
111 "name_a_b": "Case Coordinator is",
112 "label_a_b": "Case Coordinator is",
113 "name_b_a": "Case Coordinator",
114 "label_b_a": "Case Coordinator",
115 "description": "Case Coordinator",
116 "contact_type_a": "Individual",
117 "contact_type_b": "Individual",
125 "name": "housing_support",
126 "title": "Housing Support",
127 "description": "Help homeless individuals obtain temporary and long-term housing",
135 {"name": "Open Case", "max_instances": "1"}
139 "name": "standard_timeline",
140 "label": "Standard Timeline",
145 "status": "Completed"
148 "name": "Medical evaluation",
149 "reference_activity": "Open Case",
150 "reference_offset": "1",
151 "reference_select": "newest"
158 "name": "Homeless Services Coordinator",
166 ctrl
= $controller('CaseTypeCtrl', {$scope
: scope
, apiCalls
: apiCalls
});
169 it('should load activity statuses', function() {
170 expect(scope
.activityStatuses
).toEqualData([apiCalls
['actStatuses']['values']['272'], apiCalls
['actStatuses']['values']['273']]);
173 it('should load activity types', function() {
174 expect(scope
.activityTypes
).toEqualData(apiCalls
['actTypes']['values']);
177 it('addActivitySet should add an activitySet to the case type', function() {
178 scope
.addActivitySet('timeline');
179 var activitySets
= scope
.caseType
.definition
.activitySets
;
180 var newSet
= activitySets
[activitySets
.length
- 1];
181 expect(newSet
.name
).toBe('timeline_1');
182 expect(newSet
.timeline
).toBe('1');
183 expect(newSet
.label
).toBe('Timeline');
186 it('addActivitySet handles second timeline correctly', function() {
187 scope
.addActivitySet('timeline');
188 scope
.addActivitySet('timeline');
189 var activitySets
= scope
.caseType
.definition
.activitySets
;
190 var newSet
= activitySets
[activitySets
.length
- 1];
191 expect(newSet
.name
).toBe('timeline_2');
192 expect(newSet
.timeline
).toBe('1');
193 expect(newSet
.label
).toBe('Timeline #2');