Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kscc25/c2db48b8538e64319744007b3cc9d317 to your computer and use it in GitHub Desktop.
Save kscc25/c2db48b8538e64319744007b3cc9d317 to your computer and use it in GitHub Desktop.
describe('The toggleFollow function', function() {
it('should unfollow the followed user', function() {
// mock
followService.isFollowing = function() {
return true;
};
var controller = initController();
controller.toggleFollow();
expect(followService.unfollow).to.have.been.calledOnce;
expect(controller.isFollowing).to.be.false;
});
it('should follow the unfollowed user', function() {
// mock
followService.isFollowing = function() {
return false;
};
var controller = initController();
controller.toggleFollow();
expect(followService.follow).to.have.been.calledOnce;
expect(controller.isFollowing).to.be.true;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment