I need to test whether or not window.location.href = data.redirect_path
ever happens. How would I mock this in Sinon without it redirecting me away from my test runner? I'm using chai/mocha.js with teaspoon as my test runner.
$.ajax({
type: 'PUT',
url: $url,
dataType: 'json',
data: { user: $userData },
success: function(data) {
if (data.success == true) {
window.location.href = data.redirect_path
} else {
$errorsContainer.html(data.html);
$codeInput.select();
if (typeof data.redirect_path !== 'undefined') {
window.location.href = data.redirect_path
}
}
}
});