Skip to content

Commit 89d7aa8

Browse files
committed
use mock list in minified bundle suite
... for better min.js test coverage
1 parent dd8bf6c commit 89d7aa8

File tree

2 files changed

+13
-22
lines changed

2 files changed

+13
-22
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
11
/* global Plotly:false */
22

3+
var MAPBOX_ACCESS_TOKEN = require('@build/credentials.json').MAPBOX_ACCESS_TOKEN;
4+
var mockLists = require('../assets/mock_lists');
5+
36
describe('Test plotly.min.js', function() {
47
'use strict';
58

6-
// Note: this test doesn't have access to custom_matchers.js
7-
// so you can only use standard jasmine matchers here.
9+
var gd = document.createElement('div');
10+
document.body.appendChild(gd);
811

912
it('should expose Plotly global', function() {
1013
expect(window.Plotly).toBeDefined();
1114
});
1215

13-
it('should be able to plot a mapbox plot', function(done) {
14-
var gd = document.createElement('div');
15-
document.body.appendChild(gd);
16+
Plotly.setPlotConfig({
17+
mapboxAccessToken: MAPBOX_ACCESS_TOKEN
18+
});
1619

17-
Plotly.plot(gd, [{
18-
type: 'scattermapbox',
19-
lon: [10, 20, 30],
20-
lat: [10, 30, 20]
21-
}], {}, {
22-
mapboxAccessToken: 'pk.eyJ1IjoiZXRwaW5hcmQiLCJhIjoiY2luMHIzdHE0MGFxNXVubTRxczZ2YmUxaCJ9.hwWZful0U2CQxit4ItNsiQ'
23-
})
24-
.catch(function() {
25-
fail('mapbox plot failed');
26-
})
27-
.then(function() {
28-
document.body.removeChild(gd);
29-
done();
20+
mockLists.all.forEach(function(mockSpec) {
21+
it('can plot "' + mockSpec[0] + '"', function(done) {
22+
Plotly.newPlot(gd, mockSpec[1]).catch(fail).then(done);
3023
});
3124
});
3225
});

test/jasmine/karma.conf.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,8 @@ if(isFullSuite) {
256256
delete func.defaultConfig.preprocessors[pathToCustomMatchers];
257257
break;
258258
case 'minified_bundle':
259-
// browserified custom_matchers doesn't work with this route
260-
// so clear them out of the files and preprocessors
261-
func.defaultConfig.files = [constants.pathToPlotlyDistMin];
262-
delete func.defaultConfig.preprocessors[pathToCustomMatchers];
259+
func.defaultConfig.files.push(constants.pathToPlotlyDistMin);
260+
func.defaultConfig.preprocessors[testFileGlob] = ['browserify'];
263261
break;
264262
case 'ie9':
265263
// load ie9_mock.js before plotly.js+test bundle

0 commit comments

Comments
 (0)