angular-calendar
angular-calendar copied to clipboard
unit testing: calendar-date.pipe error
Describe the bug
When attempting to unit test a component that consumes angular-calendar. we get an error regarding the import.
Minimal reproduction of the problem with instructions This is how I have currently setup my testbed.
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
CalendarComponent,
AngularCalendarComponent,
CalendarDatePipe
],
imports: [
HttpClientTestingModule,
RouterTestingModule.withRoutes([{
path: 'calendar',
component: CalendarComponent
}]),
],
providers: [
CommonUtils,
CalendarService,
]
}).compileComponents();
});
Screenshots

Versions
@angular/core:12.0.1angular-calendar:0.29.0- Browser name and version:
Google Chrome-Version 97.0.4692.99 (Official Build) (64-bit)
Thanks so much for opening an issue! If you'd like me to give priority to answering your issue or would just like to support this project, then please consider sponsoring me
I just solved this after quite a bit of struggle.
It turns out that you need to import the CalendarCommonModule in your TestBed configuration. Mine also asked to provide DateAdapter, and CalendarDateFormatter from this package.
Hope this helps!