Skip to content

Commit 18b12f2

Browse files
authored
Merge pull request #2918 from plotly/only-failTest
no more fail for async tests, only failTest
2 parents f28caae + 1d56dbf commit 18b12f2

20 files changed

+177
-115
lines changed

test/jasmine/tests/command_test.js

+27-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var Registry = require('@src/registry');
33
var Plots = Plotly.Plots;
44
var createGraphDiv = require('../assets/create_graph_div');
55
var destroyGraphDiv = require('../assets/destroy_graph_div');
6-
var fail = require('../assets/fail_test');
6+
var failTest = require('../assets/fail_test');
77
var Lib = require('@src/lib');
88

99
describe('Plots.executeAPICommand', function() {
@@ -34,7 +34,9 @@ describe('Plots.executeAPICommand', function() {
3434
expect(m.calls.argsFor(0)).toEqual([gd, 'foo', 'bar']);
3535

3636
expect(value).toEqual('resolution');
37-
}).catch(fail).then(done);
37+
})
38+
.catch(failTest)
39+
.then(done);
3840
});
3941

4042
});
@@ -47,22 +49,24 @@ describe('Plots.executeAPICommand', function() {
4749
});
4850

4951
it('calls the API method and rejects', function(done) {
50-
Plots.executeAPICommand(gd, 'restyle', ['foo', 'bar']).then(fail, function(value) {
52+
Plots.executeAPICommand(gd, 'restyle', ['foo', 'bar']).then(failTest, function(value) {
5153
var m = Registry.apiMethodRegistry.restyle;
5254
expect(m).toHaveBeenCalled();
5355
expect(m.calls.count()).toEqual(1);
5456
expect(m.calls.argsFor(0)).toEqual([gd, 'foo', 'bar']);
5557

5658
expect(value).toEqual('rejection');
57-
}).catch(fail).then(done);
59+
})
60+
.catch(failTest)
61+
.then(done);
5862
});
5963

6064
});
6165

6266
describe('with the skip command', function() {
6367
it('resolves immediately', function(done) {
6468
Plots.executeAPICommand(gd, 'skip')
65-
.catch(fail).then(done);
69+
.catch(failTest).then(done);
6670
});
6771
});
6872
});
@@ -514,7 +518,9 @@ describe('component bindings', function() {
514518
return Plotly.restyle(gd, 'marker.width', 8);
515519
}).then(function() {
516520
expect(count).toEqual(1);
517-
}).catch(fail).then(done);
521+
})
522+
.catch(failTest)
523+
.then(done);
518524
});
519525

520526
it('logs a warning if unable to create an observer', function() {
@@ -536,15 +542,19 @@ describe('component bindings', function() {
536542

537543
Plotly.restyle(gd, 'marker.color', 'blue').then(function() {
538544
expect(gd.layout.sliders[0].active).toBe(4);
539-
}).catch(fail).then(done);
545+
})
546+
.catch(failTest)
547+
.then(done);
540548
});
541549

542550
it('does not update the component if the value is not present', function(done) {
543551
expect(gd.layout.sliders[0].active).toBe(0);
544552

545553
Plotly.restyle(gd, 'marker.color', 'black').then(function() {
546554
expect(gd.layout.sliders[0].active).toBe(0);
547-
}).catch(fail).then(done);
555+
})
556+
.catch(failTest)
557+
.then(done);
548558
});
549559

550560
it('udpates bound components when the computed value changes', function(done) {
@@ -555,7 +565,9 @@ describe('component bindings', function() {
555565
// nonetheless is bound by value to the component.
556566
Plotly.restyle(gd, 'line.color', 'blue').then(function() {
557567
expect(gd.layout.sliders[0].active).toBe(4);
558-
}).catch(fail).then(done);
568+
})
569+
.catch(failTest)
570+
.then(done);
559571
});
560572
});
561573

@@ -623,7 +635,9 @@ describe('attaching component bindings', function() {
623635
// Bindings are no longer simple, so check to ensure they have
624636
// been removed
625637
expect(gd._internalEv._events.plotly_animatingframe).toBeUndefined();
626-
}).catch(fail).then(done);
638+
})
639+
.catch(failTest)
640+
.then(done);
627641
});
628642

629643
it('attaches and updates bindings for updatemenus', function(done) {
@@ -676,6 +690,8 @@ describe('attaching component bindings', function() {
676690
// Bindings are no longer simple, so check to ensure they have
677691
// been removed
678692
expect(gd._internalEv._events.plotly_animatingframe).toBeUndefined();
679-
}).catch(fail).then(done);
693+
})
694+
.catch(failTest)
695+
.then(done);
680696
});
681697
});

test/jasmine/tests/download_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var Plotly = require('@lib/index');
22
var createGraphDiv = require('../assets/create_graph_div');
33
var destroyGraphDiv = require('../assets/destroy_graph_div');
44
var textchartMock = require('@mocks/text_chart_arrays.json');
5-
var fail = require('../assets/fail_test');
5+
var failTest = require('../assets/fail_test');
66

77
var Lib = require('@src/lib');
88

@@ -106,7 +106,7 @@ describe('Plotly.downloadImage', function() {
106106
reader.readAsText(savedBlob);
107107
});
108108
})
109-
.catch(fail)
109+
.catch(failTest)
110110
.then(done);
111111
}, LONG_TIMEOUT_INTERVAL);
112112
});

test/jasmine/tests/drawing_test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var Drawing = require('@src/components/drawing');
44
var svgTextUtils = require('@src/lib/svg_text_utils');
55
var createGraphDiv = require('../assets/create_graph_div');
66
var destroyGraphDiv = require('../assets/destroy_graph_div');
7-
var fail = require('../assets/fail_test');
7+
var failTest = require('../assets/fail_test');
88

99
describe('Drawing', function() {
1010
'use strict';
@@ -422,7 +422,7 @@ describe('Drawing', function() {
422422
bottom: 4
423423
});
424424
})
425-
.catch(fail)
425+
.catch(failTest)
426426
.then(done);
427427
});
428428

@@ -546,7 +546,7 @@ describe('gradients', function() {
546546
// full replot and no resulting markers at all -> no gradients
547547
checkGradientIds([], [], [], []);
548548
})
549-
.catch(fail)
549+
.catch(failTest)
550550
.then(done);
551551
});
552552
});

test/jasmine/tests/errorbars_test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var Plotly = require('@lib/index');
33
var d3 = require('d3');
44
var createGraphDiv = require('../assets/create_graph_div');
55
var destroyGraphDiv = require('../assets/destroy_graph_div');
6-
var fail = require('../assets/fail_test');
6+
var failTest = require('../assets/fail_test');
77

88

99
describe('errorbar plotting', function() {
@@ -61,7 +61,7 @@ describe('errorbar plotting', function() {
6161
.then(function() {
6262
check([-0.6667, 2.6667], [-0.2629, 4.9949], 3, 3);
6363
})
64-
.catch(fail)
64+
.catch(failTest)
6565
.then(done);
6666
});
6767

@@ -97,7 +97,7 @@ describe('errorbar plotting', function() {
9797
{xs: 10, xh: 18}
9898
]);
9999
})
100-
.catch(fail)
100+
.catch(failTest)
101101
.then(done);
102102
});
103103
});

0 commit comments

Comments
 (0)