Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c6df699

Browse files
committed
update tests (mostly update ref to spyOn modules)
1 parent 2c529ec commit c6df699

File tree

5 files changed

+62
-68
lines changed

5 files changed

+62
-68
lines changed

test/jasmine/karma.conf.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,7 @@ if(isFullSuite) {
260260
}
261261
} else {
262262
// Add lib/index.js to non-full-suite runs,
263-
// to avoid import conflicts due to plotly.js
264-
// circular dependencies.
265-
263+
// to make sure the registry is set-up correctly.
266264
func.defaultConfig.files.push(
267265
pathToJQuery,
268266
pathToMain

test/jasmine/tests/command_test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var Plotly = require('@lib/index');
2-
var PlotlyInternal = require('@src/plotly');
2+
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');
@@ -21,14 +21,14 @@ describe('Plots.executeAPICommand', function() {
2121

2222
describe('with a successful API command', function() {
2323
beforeEach(function() {
24-
spyOn(PlotlyInternal, 'restyle').and.callFake(function() {
24+
spyOn(Registry.apiMethodRegistry, 'restyle').and.callFake(function() {
2525
return Promise.resolve('resolution');
2626
});
2727
});
2828

2929
it('calls the API method and resolves', function(done) {
3030
Plots.executeAPICommand(gd, 'restyle', ['foo', 'bar']).then(function(value) {
31-
var m = PlotlyInternal.restyle;
31+
var m = Registry.apiMethodRegistry.restyle;
3232
expect(m).toHaveBeenCalled();
3333
expect(m.calls.count()).toEqual(1);
3434
expect(m.calls.argsFor(0)).toEqual([gd, 'foo', 'bar']);
@@ -41,14 +41,14 @@ describe('Plots.executeAPICommand', function() {
4141

4242
describe('with an unsuccessful command', function() {
4343
beforeEach(function() {
44-
spyOn(PlotlyInternal, 'restyle').and.callFake(function() {
44+
spyOn(Registry.apiMethodRegistry, 'restyle').and.callFake(function() {
4545
return Promise.reject('rejection');
4646
});
4747
});
4848

4949
it('calls the API method and rejects', function(done) {
5050
Plots.executeAPICommand(gd, 'restyle', ['foo', 'bar']).then(fail, function(value) {
51-
var m = PlotlyInternal.restyle;
51+
var m = Registry.apiMethodRegistry.restyle;
5252
expect(m).toHaveBeenCalled();
5353
expect(m.calls.count()).toEqual(1);
5454
expect(m.calls.argsFor(0)).toEqual([gd, 'foo', 'bar']);

test/jasmine/tests/lib_test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ var config = require('@src/plot_api/plot_config');
55

66
var d3 = require('d3');
77
var Plotly = require('@lib');
8-
var PlotlyInternal = require('@src/plotly');
8+
var Plots = require('@src/plots/plots');
99
var createGraphDiv = require('../assets/create_graph_div');
1010
var destroyGraphDiv = require('../assets/destroy_graph_div');
11-
var Plots = PlotlyInternal.Plots;
1211
var failTest = require('../assets/fail_test');
1312

1413
describe('Test lib.js:', function() {

0 commit comments

Comments
 (0)