Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 模拟或截短高图。使用sinon绘制图表_Javascript_Unit Testing_Highcharts_Sinon - Fatal编程技术网

Javascript 模拟或截短高图。使用sinon绘制图表

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

我正在尝试使用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 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

我不明白这个错误。是否可以模拟或存根高图表。如果不是,我会尝试为我的测试创建一个真实的


谢谢。

请提供您想要测试的最小完整代码。您是否能够在我可以使用的在线编辑器上重现您的案例?