community-app/test/spec/controllers/RoleControllerSpec.js
Alex Anto Navis L 6bc5426e08
Fixed #2904 - Recreated from another in-active PR (#3301)
* Fixed #2904 - Recreated from another in-active PR


- https://github.com/openMF/community-app/pull/2905
- Had merge conflicts and branch is inactive
- Tested the scenarios

* Fixed #2904 - Fixed the existing test
2020-08-25 10:21:03 -07:00

23 lines
713 B
JavaScript

describe("RoleController", function () {
var resourceCallback;
beforeEach(function () {
this.scope = jasmine.createSpyObj("$scope", ['saveSC']);
this.scope.searchCriteria = {}
this.resourceFactory = { roleResource: {
getAllRoles: jasmine.createSpy('roleResource.getAllRoles()').andCallFake(function (params, callback) {
resourceCallback = callback;
})
}};
this.controller = new mifosX.controllers.RoleController(this.scope, this.resourceFactory);
});
it("should get all roles", function () {
resourceCallback(['role1', 'role2']);
expect(this.scope.roles).toEqual(['role1', 'role2']);
});
});