forked from pombredanne/taiga-layout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-utils.js
35 lines (28 loc) · 846 Bytes
/
test-utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(function() {
var searchOriginal = function(obj) {
if (obj._promise) {
return obj;
} else {
return searchOriginal(obj.parent);
}
};
sinon.stub.promise = function() {
var obj = this;
var returnedPromise = new Promise(function(_resolve_, _reject_){
obj._resolvefn = _resolve_;
obj._rejectfn = _reject_;
});
this.returns(returnedPromise);
this._promise = true;
return this;
};
sinon.stub.resolve = function() {
var original = searchOriginal(this);
original._resolvefn.apply(this, arguments);
};
sinon.stub.reject = function() {
var original = searchOriginal(this);
original._rejectfn.apply(this, arguments);
};
window.addDecorator = function() {};
}());