Adding failure paths for all async tests

This will ensure the tests fail if the intended path isn't followed
This commit is contained in:
Jeff Avallone 2014-12-27 16:04:22 -05:00
parent 9a412b6b3e
commit 08fdb254fc
12 changed files with 47 additions and 47 deletions

View File

@ -95,7 +95,7 @@ describe('parser/javascript/charset_range.js', function() {
'hyphen', 'hyphen',
this.node.last this.node.last
], { padding: 5 }); ], { padding: 5 });
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });

View File

@ -143,7 +143,7 @@ describe('parser/javascript/charset.js', function() {
this.node._render() this.node._render()
.then(() => { .then(() => {
expect(util.spaceVertically).toHaveBeenCalledWith(this.node.elements, { padding: 5 }); expect(util.spaceVertically).toHaveBeenCalledWith(this.node.elements, { padding: 5 });
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -153,7 +153,7 @@ describe('parser/javascript/charset.js', function() {
.then(result => { .then(result => {
expect(this.node.renderLabeledBox).toHaveBeenCalledWith('example label', this.partContainer, { padding: 5 }); expect(this.node.renderLabeledBox).toHaveBeenCalledWith('example label', this.partContainer, { padding: 5 });
expect(result).toEqual('labeled box promise'); expect(result).toEqual('labeled box promise');
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });

View File

@ -63,7 +63,7 @@ describe('parser/javascript/escape.js', function() {
rx: '3', rx: '3',
ry: '3' ry: '3'
})); }));
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });

View File

@ -43,7 +43,7 @@ describe('parser/javascript/literal.js', function() {
.then(label => { .then(label => {
expect(label.selectAll('tspan')[0].hasClass('quote')).toBeTruthy(); expect(label.selectAll('tspan')[0].hasClass('quote')).toBeTruthy();
expect(label.selectAll('tspan')[2].hasClass('quote')).toBeTruthy(); expect(label.selectAll('tspan')[2].hasClass('quote')).toBeTruthy();
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -55,7 +55,7 @@ describe('parser/javascript/literal.js', function() {
rx: '3', rx: '3',
ry: '3' ry: '3'
})); }));
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });

View File

@ -99,7 +99,7 @@ describe('parser/javascript/match_fragment.js', function() {
this.node._render() this.node._render()
.then(() => { .then(() => {
expect(this.node.content.transform).toHaveBeenCalledWith('example position'); expect(this.node.content.transform).toHaveBeenCalledWith('example position');
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -110,7 +110,7 @@ describe('parser/javascript/match_fragment.js', function() {
expect(this.node.skipPath).toHaveBeenCalledWith('content bbox'); expect(this.node.skipPath).toHaveBeenCalledWith('content bbox');
expect(this.node.loopPath).toHaveBeenCalledWith('content bbox'); expect(this.node.loopPath).toHaveBeenCalledWith('content bbox');
expect(this.node.container.path).toHaveBeenCalledWith('skip pathloop path'); expect(this.node.container.path).toHaveBeenCalledWith('skip pathloop path');
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -119,7 +119,7 @@ describe('parser/javascript/match_fragment.js', function() {
this.node._render() this.node._render()
.then(() => { .then(() => {
expect(this.node.loopLabel).toHaveBeenCalled(); expect(this.node.loopLabel).toHaveBeenCalled();
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });

View File

@ -215,7 +215,7 @@ describe('parser/javascript/match.js', function() {
.then(() => { .then(() => {
expect(this.node.start).toEqual('start label'); expect(this.node.start).toEqual('start label');
expect(this.node.end).toEqual('end label'); expect(this.node.end).toEqual('end label');
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -230,7 +230,7 @@ describe('parser/javascript/match.js', function() {
'part 2', 'part 2',
'end label' 'end label'
], { padding: 10 }); ], { padding: 10 });
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -246,7 +246,7 @@ describe('parser/javascript/match.js', function() {
'end label' 'end label'
]); ]);
expect(this.node.container.path).toHaveBeenCalledWith('connector paths'); expect(this.node.container.path).toHaveBeenCalledWith('connector paths');
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });

View File

@ -126,7 +126,7 @@ describe('parser/javascript/node.js', function() {
.then(() => { .then(() => {
expect(resolve).toHaveBeenCalledWith('result'); expect(resolve).toHaveBeenCalledWith('result');
expect(reject).not.toHaveBeenCalled(); expect(reject).not.toHaveBeenCalled();
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -141,7 +141,7 @@ describe('parser/javascript/node.js', function() {
.then(() => { .then(() => {
expect(resolve).not.toHaveBeenCalled(); expect(resolve).not.toHaveBeenCalled();
expect(reject).toHaveBeenCalledWith('Render cancelled'); expect(reject).toHaveBeenCalledWith('Render cancelled');
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -193,7 +193,7 @@ describe('parser/javascript/node.js', function() {
.then(() => { .then(() => {
expect(this.text.transform).toHaveBeenCalledWith(Snap.matrix() expect(this.text.transform).toHaveBeenCalledWith(Snap.matrix()
.translate(5, 22)); .translate(5, 22));
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -205,7 +205,7 @@ describe('parser/javascript/node.js', function() {
width: 52, width: 52,
height: 34 height: 34
}); });
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -214,7 +214,7 @@ describe('parser/javascript/node.js', function() {
this.node.renderLabel('example label') this.node.renderLabel('example label')
.then(group => { .then(group => {
expect(group).toEqual(this.group); expect(group).toEqual(this.group);
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -331,7 +331,7 @@ describe('parser/javascript/node.js', function() {
this.node.render(this.container) this.node.render(this.container)
.then(() => { .then(() => {
expect(this.node.doneRender).toHaveBeenCalled(); expect(this.node.doneRender).toHaveBeenCalled();
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -340,7 +340,7 @@ describe('parser/javascript/node.js', function() {
this.node.render(this.container) this.node.render(this.container)
.then(result => { .then(result => {
expect(result).toEqual(this.node); expect(result).toEqual(this.node);
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -418,7 +418,7 @@ describe('parser/javascript/node.js', function() {
.then(() => { .then(() => {
expect(this.text.transform).toHaveBeenCalledWith(Snap.matrix() expect(this.text.transform).toHaveBeenCalledWith(Snap.matrix()
.translate(0, 20)); .translate(0, 20));
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -429,7 +429,7 @@ describe('parser/javascript/node.js', function() {
.then(() => { .then(() => {
expect(this.rect.transform).toHaveBeenCalledWith(Snap.matrix() expect(this.rect.transform).toHaveBeenCalledWith(Snap.matrix()
.translate(0, 20)); .translate(0, 20));
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -442,7 +442,7 @@ describe('parser/javascript/node.js', function() {
width: 210, width: 210,
height: 110 height: 110
}) })
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -460,7 +460,7 @@ describe('parser/javascript/node.js', function() {
width: 100, width: 100,
height: 110 height: 110
}) })
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -471,7 +471,7 @@ describe('parser/javascript/node.js', function() {
.then(() => { .then(() => {
expect(this.content.transform).toHaveBeenCalledWith(Snap.matrix() expect(this.content.transform).toHaveBeenCalledWith(Snap.matrix()
.translate(5, 25)); .translate(5, 25));
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });

View File

@ -104,7 +104,7 @@ describe('parser/javascript/regexp.js', function() {
this.node._render() this.node._render()
.then(() => { .then(() => {
expect(util.spaceVertically).toHaveBeenCalledWith(this.node.matches, { padding: 5 }); expect(util.spaceVertically).toHaveBeenCalledWith(this.node.matches, { padding: 5 });
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -118,7 +118,7 @@ describe('parser/javascript/regexp.js', function() {
expect(this.node.makeSide).toHaveBeenCalledWith('container bbox', this.node.matches[0]); expect(this.node.makeSide).toHaveBeenCalledWith('container bbox', this.node.matches[0]);
expect(this.node.makeSide).toHaveBeenCalledWith('container bbox', this.node.matches[2]); expect(this.node.makeSide).toHaveBeenCalledWith('container bbox', this.node.matches[2]);
expect(this.node.container.path).toHaveBeenCalledWith('curvecurvecurvesideside'); expect(this.node.container.path).toHaveBeenCalledWith('curvecurvecurvesideside');
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -130,7 +130,7 @@ describe('parser/javascript/regexp.js', function() {
expect(this.node.makeConnector).toHaveBeenCalledWith('group bbox', this.node.matches[1]); expect(this.node.makeConnector).toHaveBeenCalledWith('group bbox', this.node.matches[1]);
expect(this.node.makeConnector).toHaveBeenCalledWith('group bbox', this.node.matches[2]); expect(this.node.makeConnector).toHaveBeenCalledWith('group bbox', this.node.matches[2]);
expect(this.group.path).toHaveBeenCalledWith('connectorconnectorconnector'); expect(this.group.path).toHaveBeenCalledWith('connectorconnectorconnector');
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });

View File

@ -114,7 +114,7 @@ describe('parser/javascript/root.js', function() {
this.node._render() this.node._render()
.then(() => { .then(() => {
expect(this.node.container.path).toHaveBeenCalledWith('M1,2H0M3,2H14'); expect(this.node.container.path).toHaveBeenCalledWith('M1,2H0M3,2H14');
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -124,7 +124,7 @@ describe('parser/javascript/root.js', function() {
.then(() => { .then(() => {
expect(this.node.container.circle).toHaveBeenCalledWith(0, 2, 5); expect(this.node.container.circle).toHaveBeenCalledWith(0, 2, 5);
expect(this.node.container.circle).toHaveBeenCalledWith(14, 2, 5); expect(this.node.container.circle).toHaveBeenCalledWith(14, 2, 5);
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -140,7 +140,7 @@ describe('parser/javascript/root.js', function() {
.then(() => { .then(() => {
expect(this.node.regexp.transform).toHaveBeenCalledWith(Snap.matrix() expect(this.node.regexp.transform).toHaveBeenCalledWith(Snap.matrix()
.translate(10, 20)); .translate(10, 20));
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -158,7 +158,7 @@ describe('parser/javascript/root.js', function() {
.then(() => { .then(() => {
expect(this.node.regexp.transform).toHaveBeenCalledWith(Snap.matrix() expect(this.node.regexp.transform).toHaveBeenCalledWith(Snap.matrix()
.translate(10, 0)); .translate(10, 0));
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });

View File

@ -92,7 +92,7 @@ describe('parser/javascript/subexp.js', function() {
this.node._render() this.node._render()
.then(() => { .then(() => {
expect(this.node.renderLabeledBox).toHaveBeenCalledWith('example label', this.node.regexp, { padding: 10 }); expect(this.node.renderLabeledBox).toHaveBeenCalledWith('example label', this.node.regexp, { padding: 10 });
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });

View File

@ -19,7 +19,7 @@ describe('parser/javascript.js', function() {
this.parser.parse('example expression') this.parser.parse('example expression')
.then(() => { .then(() => {
expect(regexpParser.parse).toHaveBeenCalledWith('example expression'); expect(regexpParser.parse).toHaveBeenCalledWith('example expression');
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -28,7 +28,7 @@ describe('parser/javascript.js', function() {
this.parser.parse('multiline\nexpression') this.parser.parse('multiline\nexpression')
.then(() => { .then(() => {
expect(regexpParser.parse).toHaveBeenCalledWith('multiline\\nexpression'); expect(regexpParser.parse).toHaveBeenCalledWith('multiline\\nexpression');
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -37,7 +37,7 @@ describe('parser/javascript.js', function() {
this.parser.parse('example expression') this.parser.parse('example expression')
.then(result => { .then(result => {
expect(result).toEqual(this.parser); expect(result).toEqual(this.parser);
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -46,7 +46,7 @@ describe('parser/javascript.js', function() {
this.parser.parse('/example') this.parser.parse('/example')
.then(null, result => { .then(null, result => {
expect(result).toBeDefined(); expect(result).toBeDefined();
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -99,7 +99,7 @@ describe('parser/javascript.js', function() {
.then(() => { .then(() => {
expect(this.result.transform).toHaveBeenCalledWith(Snap.matrix() expect(this.result.transform).toHaveBeenCalledWith(Snap.matrix()
.translate(6, 8)); .translate(6, 8));
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -111,7 +111,7 @@ describe('parser/javascript.js', function() {
expect(svg.getAttribute('width')).toEqual('62'); expect(svg.getAttribute('width')).toEqual('62');
expect(svg.getAttribute('height')).toEqual('44'); expect(svg.getAttribute('height')).toEqual('44');
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });

View File

@ -446,7 +446,7 @@ describe('regexper.js', function() {
this.regexper.renderRegexp('example expression') this.regexper.renderRegexp('example expression')
.then(() => { .then(() => {
expect(this.parser.render).toHaveBeenCalledWith(this.regexper.svgContainer, this.regexper.svgBase); expect(this.parser.render).toHaveBeenCalledWith(this.regexper.svgContainer, this.regexper.svgBase);
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -465,7 +465,7 @@ describe('regexper.js', function() {
this.regexper.renderRegexp('example expression') this.regexper.renderRegexp('example expression')
.then(() => { .then(() => {
expect(this.regexper.state).toEqual('has-results'); expect(this.regexper.state).toEqual('has-results');
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -474,7 +474,7 @@ describe('regexper.js', function() {
this.regexper.renderRegexp('example expression') this.regexper.renderRegexp('example expression')
.then(() => { .then(() => {
expect(this.regexper.updateLinks).toHaveBeenCalled(); expect(this.regexper.updateLinks).toHaveBeenCalled();
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -483,7 +483,7 @@ describe('regexper.js', function() {
this.regexper.renderRegexp('example expression') this.regexper.renderRegexp('example expression')
.then(() => { .then(() => {
expect(this.regexper.displayWarnings).toHaveBeenCalled(); expect(this.regexper.displayWarnings).toHaveBeenCalled();
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -492,7 +492,7 @@ describe('regexper.js', function() {
this.regexper.renderRegexp('example expression') this.regexper.renderRegexp('example expression')
.then(() => { .then(() => {
expect(this.regexper._trackEvent).toHaveBeenCalledWith('visualization', 'complete'); expect(this.regexper._trackEvent).toHaveBeenCalledWith('visualization', 'complete');
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -501,7 +501,7 @@ describe('regexper.js', function() {
this.regexper.renderRegexp('example expression') this.regexper.renderRegexp('example expression')
.then(() => { .then(() => {
expect(this.regexper.runningParser).toBeFalsy(); expect(this.regexper.runningParser).toBeFalsy();
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -520,7 +520,7 @@ describe('regexper.js', function() {
this.regexper.renderRegexp('example expression') this.regexper.renderRegexp('example expression')
.then(() => { .then(() => {
expect(this.regexper.state).toEqual(''); expect(this.regexper.state).toEqual('');
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -529,7 +529,7 @@ describe('regexper.js', function() {
this.regexper.renderRegexp('example expression') this.regexper.renderRegexp('example expression')
.then(() => { .then(() => {
expect(this.regexper._trackEvent).toHaveBeenCalledWith('visualization', 'cancelled'); expect(this.regexper._trackEvent).toHaveBeenCalledWith('visualization', 'cancelled');
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });
@ -538,7 +538,7 @@ describe('regexper.js', function() {
this.regexper.renderRegexp('example expression') this.regexper.renderRegexp('example expression')
.then(() => { .then(() => {
expect(this.regexper.runningParser).toBeFalsy(); expect(this.regexper.runningParser).toBeFalsy();
}) }, fail)
.finally(done) .finally(done)
.done(); .done();
}); });