Skip to content

Commit 83eca92

Browse files
committed
Improving tests for PlotlyViaCdnModule
1 parent e7296ee commit 83eca92

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Diff for: devdocs.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Update the version in package.json
44
* Update the version in projects/plotly/package.json
55
* Update the CHANGELOG.md
6-
* `ng test --codeCoverage=true --progress=true --watch=false`
6+
* `ng test --code-coverage=true --progress=true --watch=false`
77
* `cp README.md angular-plotly.png projects/plotly`
88
* `ng build plotly --configuration production`
99
* `git commit -am "<version>"`

Diff for: projects/plotly/src/lib/plotly-via-cdn.module.spec.ts

+20
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,24 @@ describe('PlotlyViaCDNModule', () => {
3333
expect(fn).toThrowError(msg);
3434
});
3535

36+
describe(".setPlotlyVersion", () => {
37+
it('should set Plotly version', () => {
38+
const version = "latest";
39+
spyOn(PlotlyViaCDNModule, "loadViaCDN");
40+
41+
PlotlyViaCDNModule.setPlotlyVersion(version);
42+
43+
expect(PlotlyViaCDNModule.loadViaCDN).toHaveBeenCalled();
44+
expect((PlotlyViaCDNModule as any).plotlyVersion).toBe(version);
45+
});
46+
47+
it('should NOT set Plotly version', () => {
48+
const version = "invalid";
49+
spyOn(PlotlyViaCDNModule, "loadViaCDN").and.callThrough();
50+
51+
expect(() => {
52+
PlotlyViaCDNModule.setPlotlyVersion(version);
53+
}).toThrowError("Invalid plotly version. Please set 'latest' or version number (i.e.: 1.4.3)");
54+
});
55+
});
3656
});

0 commit comments

Comments
 (0)