Updating how async specs are called

This commit is contained in:
Jeff Avallone 2014-12-19 11:51:34 -05:00
parent be145e3fac
commit abb5838113
2 changed files with 20 additions and 10 deletions

View File

@ -147,7 +147,8 @@ describe('parser/javascript/node.js', function() {
expect(resolve).toHaveBeenCalledWith('result'); expect(resolve).toHaveBeenCalledWith('result');
expect(reject).not.toHaveBeenCalled(); expect(reject).not.toHaveBeenCalled();
}) })
.then(done); .finally(done)
.done();
}); });
it('rejects the returned promise when the render is canceled', function(done) { it('rejects the returned promise when the render is canceled', function(done) {
@ -161,7 +162,8 @@ describe('parser/javascript/node.js', function() {
expect(resolve).not.toHaveBeenCalled(); expect(resolve).not.toHaveBeenCalled();
expect(reject).toHaveBeenCalledWith('Render cancelled'); expect(reject).toHaveBeenCalledWith('Render cancelled');
}) })
.then(done); .finally(done)
.done();
}); });
}); });
@ -212,7 +214,8 @@ describe('parser/javascript/node.js', function() {
expect(this.text.transform).toHaveBeenCalledWith(Snap.matrix() expect(this.text.transform).toHaveBeenCalledWith(Snap.matrix()
.translate(5, 22)); .translate(5, 22));
}) })
.then(done); .finally(done)
.done();
}); });
it('sets the dimensions of the rect element', function(done) { it('sets the dimensions of the rect element', function(done) {
@ -223,7 +226,8 @@ describe('parser/javascript/node.js', function() {
height: 34 height: 34
}); });
}) })
.then(done); .finally(done)
.done();
}); });
it('resolves with the group element', function(done) { it('resolves with the group element', function(done) {
@ -231,7 +235,8 @@ describe('parser/javascript/node.js', function() {
.then(group => { .then(group => {
expect(group).toEqual(this.group); expect(group).toEqual(this.group);
}) })
.then(done); .finally(done)
.done();
}); });
}); });
@ -347,7 +352,8 @@ describe('parser/javascript/node.js', function() {
.then(() => { .then(() => {
expect(this.node.doneRender).toHaveBeenCalled(); expect(this.node.doneRender).toHaveBeenCalled();
}) })
.then(done); .finally(done)
.done();
}); });
it('ultimately resolves with the node instance', function(done) { it('ultimately resolves with the node instance', function(done) {
@ -355,7 +361,8 @@ describe('parser/javascript/node.js', function() {
.then(result => { .then(result => {
expect(result).toEqual(this.node); expect(result).toEqual(this.node);
}) })
.then(done); .finally(done)
.done();
}); });
}); });

View File

@ -20,7 +20,8 @@ describe('parser/javascript.js', function() {
.then(() => { .then(() => {
expect(regexpParser.parse).toHaveBeenCalledWith('example expression'); expect(regexpParser.parse).toHaveBeenCalledWith('example expression');
}) })
.finally(done); .finally(done)
.done();
}); });
it('replaces newlines with "\\n"', function(done) { it('replaces newlines with "\\n"', function(done) {
@ -28,7 +29,8 @@ describe('parser/javascript.js', function() {
.then(() => { .then(() => {
expect(regexpParser.parse).toHaveBeenCalledWith('multiline\\nexpression'); expect(regexpParser.parse).toHaveBeenCalledWith('multiline\\nexpression');
}) })
.finally(done); .finally(done)
.done();
}); });
it('resolves the returned promise with the parser instance', function(done) { it('resolves the returned promise with the parser instance', function(done) {
@ -36,7 +38,8 @@ describe('parser/javascript.js', function() {
.then(result => { .then(result => {
expect(result).toEqual(this.parser); expect(result).toEqual(this.parser);
}) })
.finally(done); .finally(done)
.done();
}); });
}); });