Skip to content

Commit

Permalink
Final flow service tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmiller committed Mar 24, 2016
1 parent 8d9f7ec commit 128147e
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
1 change: 0 additions & 1 deletion elcid/assets/js/elcid/services/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ angular.module('opal.services').factory('elCIDFlow', function($routeParams){
'controller': 'OPATReferralCtrl',
'template' : '/opat/templates/modals/opat_referral.html/'
}

},
exit: function(episode){
return {
Expand Down
51 changes: 50 additions & 1 deletion elcid/assets/js/elcidtest/flow.service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@ describe('elCIDFlow', function() {
'controller': 'ElcidDischargeEpisodeCtrl',
'template' : '/templates/modals/discharge_episode.html/'
};
var diagnosis_enter = {
'controller': 'DiagnosisHospitalNumberCtrl',
'template' : '/templates/modals/hospital_number.html/'
};
var diagnosis_exit = {
'controller': 'DiagnosisDischargeCtrl',
'template' : '/templates/elcid/modals/diagnosis_discharge.html'
};
var opat_exit = {
'controller': 'OPATDischargeCtrl',
'template' : '/opat/templates/modals/discharge_opat_episode.html/'
};
var opat_enter = {
'controller': 'OPATReferralCtrl',
'template' : '/opat/templates/modals/opat_referral.html/'
};

beforeEach(function(){
module('opal.services');
Expand Down Expand Up @@ -51,9 +67,42 @@ describe('elCIDFlow', function() {
expect(Flow.enter()).toEqual(inpatient_default_enter);
});

it('should fetch hte default exit flow', function() {
it('should fetch the default exit flow', function() {
expect(Flow.exit({category: 'Inpatient'})).toEqual(inpatient_default_exit);
});

describe('Discharge Overrides', function() {

beforeEach(function(){
$routeParams.slug = 'tropical_diseases';
});

it('enter should fetch the diagnosis flow', function() {
expect(Flow.enter()).toEqual(diagnosis_enter);
});

it('should fetch the diagnosis exit flow', function() {
expect(Flow.exit({category: 'Inpatient'})).toEqual(diagnosis_exit);
});


});
});

describe('OPAT', function() {

beforeEach(function(){
$routeParams.slug = 'opat-opat_current';
});

it('should enter should fetch the flow', function() {
expect(Flow.enter()).toEqual(opat_enter);
});

it('should fetch the exit flow', function() {
expect(Flow.exit({category: 'OPAT'})).toEqual(opat_exit);
});

});

});

0 comments on commit 128147e

Please sign in to comment.