it('should call the method callWorkBookAPI', () => {
const mockData = new Blob(['test'], { type: 'application/octet-stream' });
const service = fixture.debugElement.injector.get(DataManagementService);
spyOn(service, 'getWorkbook').and.returnValue({
subscribe: (callback: any) => {
callback(mockData);
return { unsubscribe: jasmine.createSpy('unsubscribe') };
}
});
spyOn(document, 'createElement').and.returnValue({
click: jasmine.createSpy('click')
} as any);
spyOn(window.URL, 'createObjectURL').and.returnValue('blob:mock-url');
component.callWorkBookAPI();
expect(service.getWorkbook).toHaveBeenCalled();
});