undefined is not a constructor (evaluating 'PermissionsService.isPermitted (entity, crud_check)') thrown

2

Function:

function checkPermissions(entity, crud_check, msg, title, state_redirect, paramsRedirect) {
        try {
            if (PermissionsService.isPermitted(entity, crud_check) === false) {
                showToastrError(title, msg, state_redirect, paramsRedirect);
            }
        } catch (e) {
            throw e.message;
        }
    }

When you perform the following test:

it('function checkPermissions', function(){    
      spyOn(srv, 'checkPermissions').and.callThrough();
      expect(srv.checkPermissions).toBeDefined();         
      srv.checkPermissions(false, false, 'acabou erro', 'please', 'master', null);  
    }); 

I'm getting the error:

  

undefined is not a constructor (evaluating 'PermissionsService.isPermitted (entity, crud_check)') thrown

Can anyone help me solve it?

    
asked by anonymous 22.09.2017 / 22:38

0 answers