chai-changes
Advanced tools
Comparing version
@@ -40,3 +40,3 @@ // Generated by CoffeeScript 1.3.3 | ||
result = val(); | ||
isPromise = (result != null ? result.then : void 0) != null; | ||
isPromise = typeof result.then === 'function'; | ||
if (((typeof DS !== "undefined" && DS !== null ? DS.Model : void 0) != null) && result instanceof DS.Model) { | ||
@@ -67,2 +67,3 @@ isPromise = false; | ||
flag(this, 'object', newPromise); | ||
this.then = newPromise.then; | ||
} else { | ||
@@ -69,0 +70,0 @@ for (_j = 0, _len1 = definedActions.length; _j < _len1; _j++) { |
@@ -6,3 +6,3 @@ { | ||
"keywords": [ "test", "assertion", "assert", "testing", "changes", "promises" ], | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"repository": { | ||
@@ -9,0 +9,0 @@ "type": "git", |
@@ -31,6 +31,6 @@ // Generated by CoffeeScript 1.3.3 | ||
it('checks conditions after promise resolved', function(done) { | ||
var def, result; | ||
var def, p, result; | ||
result = 1; | ||
def = window.when.defer(); | ||
expect(function() { | ||
p = expect(function() { | ||
return result; | ||
@@ -42,2 +42,3 @@ }).to.change.when((function() { | ||
}); | ||
expect(typeof p.then === 'function').to.be["true"]; | ||
result += 1; | ||
@@ -47,10 +48,12 @@ return def.resolve(); | ||
it('checks conditions after promise is rejected', function(done) { | ||
var def, result; | ||
var def, p, result; | ||
result = 1; | ||
def = window.when.defer(); | ||
expect(function() { | ||
p = expect(function() { | ||
return result; | ||
}).to.change.when(function() { | ||
return def.promise; | ||
}).and.notify(done); | ||
}); | ||
expect(typeof p.then === 'function').to.be["true"]; | ||
p.notify(done); | ||
result += 1; | ||
@@ -60,10 +63,12 @@ return def.reject(); | ||
return it('returns a promise about the expectations', function(done) { | ||
var def, result; | ||
var def, p, result; | ||
result = 1; | ||
def = window.when.defer(); | ||
expect(function() { | ||
p = expect(function() { | ||
return result; | ||
}).to.change.when(function() { | ||
return def.promise; | ||
}).be.broken["with"]('expected `result;` to change, but it stayed 1').notify(done); | ||
}).be.broken["with"]('expected `result;` to change, but it stayed 1'); | ||
expect(typeof p.then === 'function').to.be["true"]; | ||
p.notify(done); | ||
return def.resolve(); | ||
@@ -70,0 +75,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
33521
1.75%438
1.39%