茉莉AG网格测试案例失败
我正在尝试编写用于Ag网格导出方法的测试。 这是组件更改
export class GridComponent extendsimplements OnInit {
gridApi: any;
onGridDataExport(): void {
this.gridApi.exportDataAsCsv();
}
}
网格组件规格文件
fdescribe('when onGridDataExport method call', () => {
it('should call gridApi', () => {
const result = spyOn(component.gridApi, 'exportDataAsCsv');
component.onGridDataExport();
expect(result).toHaveBeenCalled();
});
});
我该如何解决此问题?
期望有效的解决方案。
提前致谢
Am trying to write a test for ag grid export method.
Here is the component changes
export class GridComponent extendsimplements OnInit {
gridApi: any;
onGridDataExport(): void {
this.gridApi.exportDataAsCsv();
}
}
grid component spec file
fdescribe('when onGridDataExport method call', () => {
it('should call gridApi', () => {
const result = spyOn(component.gridApi, 'exportDataAsCsv');
component.onGridDataExport();
expect(result).toHaveBeenCalled();
});
});
when i run the test cases it show the below error
How can i resolve this issue?
expecting a valid solution.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试以下尝试:
如果您查看我的代码,我正在添加
.and.callthrough();
,并且您需要使用它,因为使用此代码,您真的在等待执行方法<代码> exportDataAscsv 。Try with this:
If you look my code, I'm adding
.and.callThrough();
and you need to use this because with this code you're really waiting for the execution of the methodexportDataAsCsv
.