Jasmine tests that require outside libraries
I was wondering what is best practice or at least a practice for using
Jasmine to test javascript that requires remote libraries called on page
load, but not in the app.
More specifically, I'm creating a backbone view for processing payments
using stripe. Stripe recommends that you load their javascript in your
layout from their servers.
But my tests don't have my layout, so when I try to do this
it("calls stripe token creation", function() {
stripeSpy = spyOn(Stripe, "createToken");
form.submit();
expect(stripeSpy).toHaveBeenCalled();
});
It gives the error.
Stripe is not defined
I'd rather not depend on remote libraries for my test, nor do I really
want to go against stripe preferred method of relying on their source
code. What would be the best way to approach this?
No comments:
Post a Comment