Javascript 模拟或截短高图。使用sinon绘制图表
我正在尝试使用sinon模拟或存根Highcharts图表对象Javascript 模拟或截短高图。使用sinon绘制图表,javascript,unit-testing,highcharts,sinon,Javascript,Unit Testing,Highcharts,Sinon,我正在尝试使用sinon模拟或存根Highcharts图表对象 let chart = sinon.mock(Highcharts.Chart); chart.expects('getSVG').returns(mockSVG); 返回的错误为: [INFO] TypeError: Attempted to wrap undefined property getSVG as function [INFO] at <Jasmine> [INFO] at wrap
let chart = sinon.mock(Highcharts.Chart);
chart.expects('getSVG').returns(mockSVG);
返回的错误为:
[INFO] TypeError: Attempted to wrap undefined property getSVG as function
[INFO] at <Jasmine>
[INFO] at wrapMethod (node_modules/sinon/pkg/sinon.js:3692:21)
[INFO] at Object.expects (node_modules/sinon/pkg/sinon.js:1701:13)
[INFO] at UserContext.<anonymous> (src/test/js/core/test_exporting.js:13:15)
[INFO] at <Jasmine>
[INFO]TypeError:试图将未定义的属性getSVG包装为函数
[信息]在
[信息]wrapMethod(node_modules/sinon/pkg/sinon.js:3692:21)
[INFO]位于Object.expects(node_modules/sinon/pkg/sinon.js:1701:13)
[信息]位于UserContext
我不明白这个错误。是否可以模拟或存根高图表。如果不是,我会尝试为我的测试创建一个真实的
谢谢。请提供您想要测试的最小完整代码。您是否能够在我可以使用的在线编辑器上重现您的案例?