Skip to content

Commit ebf7ad0

Browse files
committed
Clean up and fix test from cfcfff.
1 parent 227c499 commit ebf7ad0

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

spec/q-spec.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,24 @@ afterEach(function () {
2020
});
2121

2222
describe("computing sum of integers using promises", function() {
23-
it("should compute correct result without blowing stack", function () {
24-
var array = [];
25-
var iters = 1000;
26-
for (var i=1; i<=iters; i++){
27-
array.push(i)
28-
}
29-
var pZero = Q.fulfill(0);
30-
var result = array.reduce(function(promise, nextVal) {
31-
return promise.then(function(currentVal) {
32-
var pNext = Q.fulfill(currentVal + nextVal);
33-
return pNext;
34-
});
35-
}, pZero);
36-
result.then(function(value){
37-
expect(value).toEqual(iters*(iters+1)/2);
38-
done();
39-
});
40-
});
23+
it("should compute correct result without blowing stack", function () {
24+
var array = [];
25+
var iters = 1000;
26+
for (var i = 1; i <= iters; i++) {
27+
array.push(i);
28+
}
29+
30+
var pZero = Q.fulfill(0);
31+
var result = array.reduce(function (promise, nextVal) {
32+
return promise.then(function (currentVal) {
33+
return Q.fulfill(currentVal + nextVal);
34+
});
35+
}, pZero);
36+
37+
return result.then(function (value) {
38+
expect(value).toEqual(iters * (iters + 1) / 2);
39+
});
40+
});
4141
});
4242

4343
describe("Q function", function () {

0 commit comments

Comments
 (0)