From 08fdb254fc25aad756dd646f0b6ceb71c311c496 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sat, 27 Dec 2014 16:04:22 -0500 Subject: [PATCH] Adding failure paths for all async tests This will ensure the tests fail if the intended path isn't followed --- spec/parser/javascript/charset_range_spec.js | 2 +- spec/parser/javascript/charset_spec.js | 4 ++-- spec/parser/javascript/escape_spec.js | 2 +- spec/parser/javascript/literal_spec.js | 4 ++-- spec/parser/javascript/match_fragment_spec.js | 6 ++--- spec/parser/javascript/match_spec.js | 6 ++--- spec/parser/javascript/node_spec.js | 24 +++++++++---------- spec/parser/javascript/regexp_spec.js | 6 ++--- spec/parser/javascript/root_spec.js | 8 +++---- spec/parser/javascript/subexp_spec.js | 2 +- spec/parser/javascript_spec.js | 12 +++++----- spec/regexper_spec.js | 18 +++++++------- 12 files changed, 47 insertions(+), 47 deletions(-) diff --git a/spec/parser/javascript/charset_range_spec.js b/spec/parser/javascript/charset_range_spec.js index 981b291..ef4d6e3 100644 --- a/spec/parser/javascript/charset_range_spec.js +++ b/spec/parser/javascript/charset_range_spec.js @@ -95,7 +95,7 @@ describe('parser/javascript/charset_range.js', function() { 'hyphen', this.node.last ], { padding: 5 }); - }) + }, fail) .finally(done) .done(); }); diff --git a/spec/parser/javascript/charset_spec.js b/spec/parser/javascript/charset_spec.js index 559706e..c0d96ef 100644 --- a/spec/parser/javascript/charset_spec.js +++ b/spec/parser/javascript/charset_spec.js @@ -143,7 +143,7 @@ describe('parser/javascript/charset.js', function() { this.node._render() .then(() => { expect(util.spaceVertically).toHaveBeenCalledWith(this.node.elements, { padding: 5 }); - }) + }, fail) .finally(done) .done(); }); @@ -153,7 +153,7 @@ describe('parser/javascript/charset.js', function() { .then(result => { expect(this.node.renderLabeledBox).toHaveBeenCalledWith('example label', this.partContainer, { padding: 5 }); expect(result).toEqual('labeled box promise'); - }) + }, fail) .finally(done) .done(); }); diff --git a/spec/parser/javascript/escape_spec.js b/spec/parser/javascript/escape_spec.js index cffcd73..04e3b44 100644 --- a/spec/parser/javascript/escape_spec.js +++ b/spec/parser/javascript/escape_spec.js @@ -63,7 +63,7 @@ describe('parser/javascript/escape.js', function() { rx: '3', ry: '3' })); - }) + }, fail) .finally(done) .done(); }); diff --git a/spec/parser/javascript/literal_spec.js b/spec/parser/javascript/literal_spec.js index 920fe1c..d988fb8 100644 --- a/spec/parser/javascript/literal_spec.js +++ b/spec/parser/javascript/literal_spec.js @@ -43,7 +43,7 @@ describe('parser/javascript/literal.js', function() { .then(label => { expect(label.selectAll('tspan')[0].hasClass('quote')).toBeTruthy(); expect(label.selectAll('tspan')[2].hasClass('quote')).toBeTruthy(); - }) + }, fail) .finally(done) .done(); }); @@ -55,7 +55,7 @@ describe('parser/javascript/literal.js', function() { rx: '3', ry: '3' })); - }) + }, fail) .finally(done) .done(); }); diff --git a/spec/parser/javascript/match_fragment_spec.js b/spec/parser/javascript/match_fragment_spec.js index 272d0c5..a889fd0 100644 --- a/spec/parser/javascript/match_fragment_spec.js +++ b/spec/parser/javascript/match_fragment_spec.js @@ -99,7 +99,7 @@ describe('parser/javascript/match_fragment.js', function() { this.node._render() .then(() => { expect(this.node.content.transform).toHaveBeenCalledWith('example position'); - }) + }, fail) .finally(done) .done(); }); @@ -110,7 +110,7 @@ describe('parser/javascript/match_fragment.js', function() { expect(this.node.skipPath).toHaveBeenCalledWith('content bbox'); expect(this.node.loopPath).toHaveBeenCalledWith('content bbox'); expect(this.node.container.path).toHaveBeenCalledWith('skip pathloop path'); - }) + }, fail) .finally(done) .done(); }); @@ -119,7 +119,7 @@ describe('parser/javascript/match_fragment.js', function() { this.node._render() .then(() => { expect(this.node.loopLabel).toHaveBeenCalled(); - }) + }, fail) .finally(done) .done(); }); diff --git a/spec/parser/javascript/match_spec.js b/spec/parser/javascript/match_spec.js index 33c4f2c..4f74bf7 100644 --- a/spec/parser/javascript/match_spec.js +++ b/spec/parser/javascript/match_spec.js @@ -215,7 +215,7 @@ describe('parser/javascript/match.js', function() { .then(() => { expect(this.node.start).toEqual('start label'); expect(this.node.end).toEqual('end label'); - }) + }, fail) .finally(done) .done(); }); @@ -230,7 +230,7 @@ describe('parser/javascript/match.js', function() { 'part 2', 'end label' ], { padding: 10 }); - }) + }, fail) .finally(done) .done(); }); @@ -246,7 +246,7 @@ describe('parser/javascript/match.js', function() { 'end label' ]); expect(this.node.container.path).toHaveBeenCalledWith('connector paths'); - }) + }, fail) .finally(done) .done(); }); diff --git a/spec/parser/javascript/node_spec.js b/spec/parser/javascript/node_spec.js index ffda9d8..ee62aee 100644 --- a/spec/parser/javascript/node_spec.js +++ b/spec/parser/javascript/node_spec.js @@ -126,7 +126,7 @@ describe('parser/javascript/node.js', function() { .then(() => { expect(resolve).toHaveBeenCalledWith('result'); expect(reject).not.toHaveBeenCalled(); - }) + }, fail) .finally(done) .done(); }); @@ -141,7 +141,7 @@ describe('parser/javascript/node.js', function() { .then(() => { expect(resolve).not.toHaveBeenCalled(); expect(reject).toHaveBeenCalledWith('Render cancelled'); - }) + }, fail) .finally(done) .done(); }); @@ -193,7 +193,7 @@ describe('parser/javascript/node.js', function() { .then(() => { expect(this.text.transform).toHaveBeenCalledWith(Snap.matrix() .translate(5, 22)); - }) + }, fail) .finally(done) .done(); }); @@ -205,7 +205,7 @@ describe('parser/javascript/node.js', function() { width: 52, height: 34 }); - }) + }, fail) .finally(done) .done(); }); @@ -214,7 +214,7 @@ describe('parser/javascript/node.js', function() { this.node.renderLabel('example label') .then(group => { expect(group).toEqual(this.group); - }) + }, fail) .finally(done) .done(); }); @@ -331,7 +331,7 @@ describe('parser/javascript/node.js', function() { this.node.render(this.container) .then(() => { expect(this.node.doneRender).toHaveBeenCalled(); - }) + }, fail) .finally(done) .done(); }); @@ -340,7 +340,7 @@ describe('parser/javascript/node.js', function() { this.node.render(this.container) .then(result => { expect(result).toEqual(this.node); - }) + }, fail) .finally(done) .done(); }); @@ -418,7 +418,7 @@ describe('parser/javascript/node.js', function() { .then(() => { expect(this.text.transform).toHaveBeenCalledWith(Snap.matrix() .translate(0, 20)); - }) + }, fail) .finally(done) .done(); }); @@ -429,7 +429,7 @@ describe('parser/javascript/node.js', function() { .then(() => { expect(this.rect.transform).toHaveBeenCalledWith(Snap.matrix() .translate(0, 20)); - }) + }, fail) .finally(done) .done(); }); @@ -442,7 +442,7 @@ describe('parser/javascript/node.js', function() { width: 210, height: 110 }) - }) + }, fail) .finally(done) .done(); }); @@ -460,7 +460,7 @@ describe('parser/javascript/node.js', function() { width: 100, height: 110 }) - }) + }, fail) .finally(done) .done(); }); @@ -471,7 +471,7 @@ describe('parser/javascript/node.js', function() { .then(() => { expect(this.content.transform).toHaveBeenCalledWith(Snap.matrix() .translate(5, 25)); - }) + }, fail) .finally(done) .done(); }); diff --git a/spec/parser/javascript/regexp_spec.js b/spec/parser/javascript/regexp_spec.js index 22facd4..4a86ad5 100644 --- a/spec/parser/javascript/regexp_spec.js +++ b/spec/parser/javascript/regexp_spec.js @@ -104,7 +104,7 @@ describe('parser/javascript/regexp.js', function() { this.node._render() .then(() => { expect(util.spaceVertically).toHaveBeenCalledWith(this.node.matches, { padding: 5 }); - }) + }, fail) .finally(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[2]); expect(this.node.container.path).toHaveBeenCalledWith('curvecurvecurvesideside'); - }) + }, fail) .finally(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[2]); expect(this.group.path).toHaveBeenCalledWith('connectorconnectorconnector'); - }) + }, fail) .finally(done) .done(); }); diff --git a/spec/parser/javascript/root_spec.js b/spec/parser/javascript/root_spec.js index d37f7da..387fe00 100644 --- a/spec/parser/javascript/root_spec.js +++ b/spec/parser/javascript/root_spec.js @@ -114,7 +114,7 @@ describe('parser/javascript/root.js', function() { this.node._render() .then(() => { expect(this.node.container.path).toHaveBeenCalledWith('M1,2H0M3,2H14'); - }) + }, fail) .finally(done) .done(); }); @@ -124,7 +124,7 @@ describe('parser/javascript/root.js', function() { .then(() => { expect(this.node.container.circle).toHaveBeenCalledWith(0, 2, 5); expect(this.node.container.circle).toHaveBeenCalledWith(14, 2, 5); - }) + }, fail) .finally(done) .done(); }); @@ -140,7 +140,7 @@ describe('parser/javascript/root.js', function() { .then(() => { expect(this.node.regexp.transform).toHaveBeenCalledWith(Snap.matrix() .translate(10, 20)); - }) + }, fail) .finally(done) .done(); }); @@ -158,7 +158,7 @@ describe('parser/javascript/root.js', function() { .then(() => { expect(this.node.regexp.transform).toHaveBeenCalledWith(Snap.matrix() .translate(10, 0)); - }) + }, fail) .finally(done) .done(); }); diff --git a/spec/parser/javascript/subexp_spec.js b/spec/parser/javascript/subexp_spec.js index a0bd550..90ece7e 100644 --- a/spec/parser/javascript/subexp_spec.js +++ b/spec/parser/javascript/subexp_spec.js @@ -92,7 +92,7 @@ describe('parser/javascript/subexp.js', function() { this.node._render() .then(() => { expect(this.node.renderLabeledBox).toHaveBeenCalledWith('example label', this.node.regexp, { padding: 10 }); - }) + }, fail) .finally(done) .done(); }); diff --git a/spec/parser/javascript_spec.js b/spec/parser/javascript_spec.js index 0dd2cb9..83183c0 100644 --- a/spec/parser/javascript_spec.js +++ b/spec/parser/javascript_spec.js @@ -19,7 +19,7 @@ describe('parser/javascript.js', function() { this.parser.parse('example expression') .then(() => { expect(regexpParser.parse).toHaveBeenCalledWith('example expression'); - }) + }, fail) .finally(done) .done(); }); @@ -28,7 +28,7 @@ describe('parser/javascript.js', function() { this.parser.parse('multiline\nexpression') .then(() => { expect(regexpParser.parse).toHaveBeenCalledWith('multiline\\nexpression'); - }) + }, fail) .finally(done) .done(); }); @@ -37,7 +37,7 @@ describe('parser/javascript.js', function() { this.parser.parse('example expression') .then(result => { expect(result).toEqual(this.parser); - }) + }, fail) .finally(done) .done(); }); @@ -46,7 +46,7 @@ describe('parser/javascript.js', function() { this.parser.parse('/example') .then(null, result => { expect(result).toBeDefined(); - }) + }, fail) .finally(done) .done(); }); @@ -99,7 +99,7 @@ describe('parser/javascript.js', function() { .then(() => { expect(this.result.transform).toHaveBeenCalledWith(Snap.matrix() .translate(6, 8)); - }) + }, fail) .finally(done) .done(); }); @@ -111,7 +111,7 @@ describe('parser/javascript.js', function() { expect(svg.getAttribute('width')).toEqual('62'); expect(svg.getAttribute('height')).toEqual('44'); - }) + }, fail) .finally(done) .done(); }); diff --git a/spec/regexper_spec.js b/spec/regexper_spec.js index 6a23c94..a82bc49 100644 --- a/spec/regexper_spec.js +++ b/spec/regexper_spec.js @@ -446,7 +446,7 @@ describe('regexper.js', function() { this.regexper.renderRegexp('example expression') .then(() => { expect(this.parser.render).toHaveBeenCalledWith(this.regexper.svgContainer, this.regexper.svgBase); - }) + }, fail) .finally(done) .done(); }); @@ -465,7 +465,7 @@ describe('regexper.js', function() { this.regexper.renderRegexp('example expression') .then(() => { expect(this.regexper.state).toEqual('has-results'); - }) + }, fail) .finally(done) .done(); }); @@ -474,7 +474,7 @@ describe('regexper.js', function() { this.regexper.renderRegexp('example expression') .then(() => { expect(this.regexper.updateLinks).toHaveBeenCalled(); - }) + }, fail) .finally(done) .done(); }); @@ -483,7 +483,7 @@ describe('regexper.js', function() { this.regexper.renderRegexp('example expression') .then(() => { expect(this.regexper.displayWarnings).toHaveBeenCalled(); - }) + }, fail) .finally(done) .done(); }); @@ -492,7 +492,7 @@ describe('regexper.js', function() { this.regexper.renderRegexp('example expression') .then(() => { expect(this.regexper._trackEvent).toHaveBeenCalledWith('visualization', 'complete'); - }) + }, fail) .finally(done) .done(); }); @@ -501,7 +501,7 @@ describe('regexper.js', function() { this.regexper.renderRegexp('example expression') .then(() => { expect(this.regexper.runningParser).toBeFalsy(); - }) + }, fail) .finally(done) .done(); }); @@ -520,7 +520,7 @@ describe('regexper.js', function() { this.regexper.renderRegexp('example expression') .then(() => { expect(this.regexper.state).toEqual(''); - }) + }, fail) .finally(done) .done(); }); @@ -529,7 +529,7 @@ describe('regexper.js', function() { this.regexper.renderRegexp('example expression') .then(() => { expect(this.regexper._trackEvent).toHaveBeenCalledWith('visualization', 'cancelled'); - }) + }, fail) .finally(done) .done(); }); @@ -538,7 +538,7 @@ describe('regexper.js', function() { this.regexper.renderRegexp('example expression') .then(() => { expect(this.regexper.runningParser).toBeFalsy(); - }) + }, fail) .finally(done) .done(); });