Last active
August 29, 2015 14:02
-
-
Save ghankerson/21639d69a73c26b65b17 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("Isolation", function() { | |
var obj = { | |
save: function() { | |
this.getQuantity(); | |
}, | |
getQuantity: function () { | |
console.log('returning 5'); | |
return 5; | |
} | |
}; | |
it('Should spy on save', function() { | |
var spy = spyOn(obj, 'getQuantity'); | |
saved = obj.save(); | |
expect(spy).toHaveBeenCalled(); | |
}); | |
}); | |
describe("Isolating login method and calling checkForSimpleLogin", function() { | |
var app = new Dapp(); | |
var e; | |
beforeEach(function() { | |
app.init({}, true); | |
$('body').click( function(event) { | |
e = event; | |
}); | |
$('body').click(); | |
}); | |
it('Should spy on checkForSimpleLogin', function() { | |
var spy = spyOn(app, "checkForSimpleLogin"); | |
app.login(e); | |
expect(spy).toHaveBeenCalled(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment