Skip to content

Commit

Permalink
handle failure condition
Browse files Browse the repository at this point in the history
  • Loading branch information
fredkingham committed Mar 7, 2017
1 parent c698e9e commit abbc74f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
9 changes: 7 additions & 2 deletions walkin/static/js/walkin/controllers/walkin_discharge.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,14 @@ controllers.controller(
size: 'lg',
resolve: {episode: episode}
});
modal.result.then(function(){
modal.result.then(
function(){
$modalInstance.close("discharged");
});
},
function(){
$modalInstance.close("discharged");
}
);
});
});
};
Expand Down
15 changes: 15 additions & 0 deletions walkin/static/js/walkintest/walkin_discharge.controller.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,21 @@
expect(modalResolved).toHaveBeenCalled();
expect($modalInstance.close).toHaveBeenCalledWith('discharged');
});

it('Should save the discharge date', function () {
spyOn($modalInstance, "close");
$modal.open.and.returnValue({
result: {
then: function(successFn, failureFn){
failureFn();
}
}
})
episode.tagging = [{walkin_triage: true, walkin: true}];
$scope.nurse_led_care();
$httpBackend.flush();
expect($modalInstance.close).toHaveBeenCalledWith('discharged');
});
});

describe('remove_from_list()', function (){
Expand Down

0 comments on commit abbc74f

Please sign in to comment.