Skip to content

Instantly share code, notes, and snippets.

@jeffdeville
Created January 14, 2011 02:04
Show Gist options
  • Save jeffdeville/779027 to your computer and use it in GitHub Desktop.
Save jeffdeville/779027 to your computer and use it in GitHub Desktop.
mocking the logging in of a user using the facebook javascript sdk.
describe('user is not logged in', function(){
it('should log in the user', function(){
var response = {
session: null
};
spyOn(FB, 'init');
spyOn(FB, 'getLoginStatus');
spyOn(FB, 'login');
step2._initialize();
expect(FB.init).toHaveBeenCalled();
expect(FB.getLoginStatus).toHaveBeenCalled();
FB.getLoginStatus.mostRecentCall.args[0](response);
expect(FB.login).toHaveBeenCalled();
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment