Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit385673b

Browse files
committed
Fixing tests
1 parent2fb1397 commit385673b

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

‎src/app/plotly/plotly.service.spec.ts

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,35 @@ describe('PlotlyService', () => {
3232
expect(service.getPlotly()).toBe(Plotlyjs);
3333
}));
3434

35-
it('should call plotly methods',inject([PlotlyService],(service:PlotlyService)=>{
35+
it('should call plotly.newPlot method',inject([PlotlyService],(service:PlotlyService)=>{
3636
constplotly=service.getPlotly();
37-
constmethods:(keyofPlotlyService)[]=['plot','update','newPlot'];
38-
methods.forEach(methodName=>{
39-
spyOn(plotly,methodName).and.returnValue(newPromise(()=>{}));
4037

41-
(serviceasany)[methodName]('one'asany,'two'asany,'three'asany,'four'asany);
42-
expect(plotly[methodName]).toHaveBeenCalledWith('one','two','three','four');
43-
});
38+
spyOn(plotly,'newPlot').and.returnValue(newPromise(()=>{}));
39+
service.newPlot('one'asany,'two'asany,'three'asany,'four'asany);
40+
expect(plotly.newPlot).toHaveBeenCalledWith('one','two','three','four');
41+
}));
4442

45-
spyOn(plotly.Plots,'resize');
46-
service.resize('one'asany);
47-
expect(plotly.Plots.resize).toHaveBeenCalledWith('one');
43+
it('should call plotly.plot method',inject([PlotlyService],(service:PlotlyService)=>{
44+
constplotly=service.getPlotly();
45+
46+
spyOn(plotly,'plot').and.returnValue(newPromise(()=>{}));
47+
service.plot('one'asany,'two'asany,'three'asany,'four'asany);
48+
expect(plotly.plot).toHaveBeenCalledWith('one','two','three','four');
49+
}));
50+
51+
it('should call plotly.update method',inject([PlotlyService],(service:PlotlyService)=>{
52+
constplotly=service.getPlotly();
53+
54+
spyOn(plotly,'react').and.returnValue(newPromise(()=>{}));
55+
service.update('one'asany,'two'asany,'three'asany,'four'asany);
56+
expect(plotly.react).toHaveBeenCalledWith('one','two','three','four');
4857
}));
4958

59+
it('should call plotly.Plots.resize method',inject([PlotlyService],(service:PlotlyService)=>{
60+
constplotly=service.getPlotly();
5061

62+
spyOn(plotly.Plots,'resize').and.returnValue(newPromise(()=>{}));
63+
service.resize('one'asany);
64+
expect(plotly.Plots.resize).toHaveBeenCalledWith('one');
65+
}));
5166
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp