angularjs - Unit testing function, how to implement call to mock object -
i'm writing unit tests controller has angular scope function when called, calls parse.com framework function makes call parse server , returns success parameters or error code. how go making mock of object unit test? the name of function in controller's scope parse.user.login, , here mock object i've made far. mockparse = { user: { login: function(_username, _password, callbackobj) { callbackobj.success({ attributes:{ username: "testuser", email: "testuser@example.com" } $rootscope.user = _user; $rootscope.isloggedin = true; $state.go('tab.home'); }; callbackobj.error({ err:{ code: 101 } if (err.code == 101){ $scope.error.message = "invalid login credentials"; } else { $scope.error...