Skip to content

Commit 61d1258

Browse files
authored
Add missing restore() calls to tests (#58)
The lack of these was causing a can-fixture test to fail in the main build: canjs/canjs#4783
1 parent 8becdb0 commit 61d1258

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

can-ajax-test.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ QUnit.test("abort", function (assert) {
578578
this.send = function () {};
579579
this.abort = function() {
580580
assert.ok(true, 'called the underlying XHR.abort');
581+
restore();
581582
done();
582583
};
583584
});
@@ -614,7 +615,10 @@ QUnit.test("abort prevents sending if beforeSend is not finished", function (ass
614615

615616
request.abort();
616617

617-
setTimeout(done, 10);
618+
setTimeout(function() {
619+
restore();
620+
done();
621+
}, 10);
618622
});
619623

620624
QUnit.test("beforeSend", function (assert) {
@@ -692,7 +696,10 @@ QUnit.test("beforeSend async", function (assert) {
692696
assert.ok(headers.hasOwnProperty('Authorization'), "authorization header set");
693697
}, function (reason) {
694698
assert.notOk(reason, "request failed with reason = ", reason);
695-
}).then(done);
699+
}).then(function() {
700+
restore();
701+
done();
702+
});
696703
});
697704

698705
QUnit.test("beforeSend rejects the ajax promise on failure", function (assert) {
@@ -720,7 +727,10 @@ QUnit.test("beforeSend rejects the ajax promise on failure", function (assert) {
720727
}, function (reason) {
721728
assert.ok(true, "request rejected");
722729
assert.equal(reason, error, "error is what we expect");
723-
}).then(done);
730+
}).then(function() {
731+
restore();
732+
done();
733+
});
724734
});
725735

726736
QUnit.test("async should be always true #51", function(assert){
@@ -742,7 +752,7 @@ QUnit.test("async should be always true #51", function(assert){
742752
headers[header] = value;
743753
};
744754
});
745-
755+
746756
ajax({
747757
type: "get",
748758
url: "/ep"

0 commit comments

Comments
 (0)