I’m trying to write unit test cases in Angular where I’m using plotly-plot
.
It gives error of plotly-plot
not being a known element for the component, so I added PlotlyModule
in the imports
array.
This I created in the component.spec.ts
also, if I don’t do this, it gives error of PlotlyJs object is not imported correctly
.
import * as PlotlyJS from 'plotly.js-dist-min';
import { PlotlyModule } from 'angular-plotly.js';
PlotlyModule.plotlyjs = PlotlyJS;
Then I added the module in the Testbed configuration
TestBed.configureTestingModule({
declarations:[SomeComponent],
imports:[PlotlyModule]
});
Now this throws an error component threw errors during cleanup
. But there is no subscription inside the component.
What I’m doing wrong here? How do we import the Plotly for the test cases?
Any help would be appreciated.