Skip to content

Commit

Permalink
Migrate isResolved to isPending in specs
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Jan 4, 2013
1 parent 9e58d16 commit d05d48d
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions spec/q-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ describe("promise states", function () {
it("of fulfilled value", function () {
expect(Q.isFulfilled(void 0)).toBe(true);
expect(Q.isRejected(false)).toBe(false);
expect(Q.isResolved(true)).toBe(true);
expect(Q.isPending(true)).toBe(false);
});

it("of fulfillment", function () {
Expand All @@ -766,24 +766,24 @@ describe("promise states", function () {
expect(promise.isFulfilled()).toBe(true);
expect(Q.isRejected(promise)).toBe(false);
expect(promise.isRejected()).toBe(false);
expect(Q.isResolved(promise)).toBe(true);
expect(promise.isResolved()).toBe(true);
expect(Q.isPending(promise)).toBe(false);
expect(promise.isPending()).toBe(false);
});

it("of rejection", function () {
var error = new Error("Oh, snap.");
var promise = Q.reject(error);
expect(promise.isFulfilled()).toBe(false);
expect(promise.isRejected()).toBe(true);
expect(promise.isResolved()).toBe(true);
expect(promise.isPending()).toBe(false);
});

it("of deferred", function () {
var deferred = Q.defer();
var promise = deferred.promise;
expect(promise.isFulfilled()).toBe(false);
expect(promise.isRejected()).toBe(false);
expect(promise.isResolved()).toBe(false);
expect(promise.isPending()).toBe(true);
});

it("of deferred rejection", function () {
Expand All @@ -793,7 +793,7 @@ describe("promise states", function () {
var promise = deferred.promise;
expect(promise.isFulfilled()).toBe(false);
expect(promise.isRejected()).toBe(true);
expect(promise.isResolved()).toBe(true);
expect(promise.isPending()).toBe(false);
});

it("of deferred fulfillment", function () {
Expand All @@ -802,7 +802,7 @@ describe("promise states", function () {
var promise = deferred.promise;
expect(promise.isFulfilled()).toBe(true);
expect(promise.isRejected()).toBe(false);
expect(promise.isResolved()).toBe(true);
expect(promise.isPending()).toBe(false);
});

it("of deferred deferred", function () {
Expand All @@ -812,7 +812,7 @@ describe("promise states", function () {
var promise = a.promise;
expect(promise.isFulfilled()).toBe(false);
expect(promise.isRejected()).toBe(false);
expect(promise.isResolved()).toBe(false);
expect(promise.isPending()).toBe(true);
});
});

Expand Down Expand Up @@ -980,9 +980,9 @@ describe("allResolved", function () {
expect(Q.isPromise(promises[1])).toBe(true);
expect(Q.isPromise(promises[2])).toBe(true);

expect(Q.isResolved(promises[0])).toBe(true);
expect(Q.isResolved(promises[1])).toBe(true);
expect(Q.isResolved(promises[2])).toBe(true);
expect(Q.isPending(promises[0])).toBe(false);
expect(Q.isPending(promises[1])).toBe(false);
expect(Q.isPending(promises[2])).toBe(false);

expect(Q.isFulfilled(promises[0])).toBe(true);
expect(Q.isFulfilled(promises[1])).toBe(true);
Expand Down Expand Up @@ -1107,7 +1107,7 @@ describe("fin", function () {
return promise;
})
.then(function (result) {
expect(Q.isResolved(promise)).toBe(true);
expect(Q.isPending(promise)).toBe(false);
expect(result).toBe("foo");
});
});
Expand Down Expand Up @@ -1191,7 +1191,7 @@ describe("fin", function () {
},
function (exception) {
expect(exception).toBe(exception1);
expect(Q.isResolved(promise)).toBe(true);
expect(Q.isPending(promise)).toBe(false);
});
});
});
Expand Down Expand Up @@ -1818,10 +1818,10 @@ describe("possible regressions", function () {

describe("gh-9", function () {
it("treats falsy values as resolved values without error", function () {
expect(Q.isResolved(null)).toEqual(true);
expect(Q.isResolved(void 0)).toEqual(true);
expect(Q.isResolved(false)).toEqual(true);
expect(Q.isResolved()).toEqual(true);
expect(Q.isPending(null)).toEqual(false);
expect(Q.isPending(void 0)).toEqual(false);
expect(Q.isPending(false)).toEqual(false);
expect(Q.isPending()).toEqual(false);
});
});

Expand Down

0 comments on commit d05d48d

Please sign in to comment.