i have a component that have circular dependency and followed this article
everything is working but failed test case which i unable to solve this
@Component({
selector: 'my-list',
templateUrl: './list.component.html',
styleUrls: ['./list.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [forwardRef(() => CustomTypeComponent)]
})
test
describe('listOffersComponent', () => {
let component: ListComponent;
let fixture: ComponentFixture<ListComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ListComponent],
providers: []
})
.compileComponents();
fixture = TestBed.createComponent(ListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
// TODO: need to solve how to provide testbed with circular dependency, did not find solutuon
// eslint-disable-next-line jest/no-disabled-tests
it('should create', () => {
expect(component).toBeTruthy();
});
});
error
TypeError: Cannot read properties of undefined (reading 'ɵcmp')
9 |
10 | beforeEach(async () => {
> 11 | await TestBed.configureTestingModule({
try to import ref component in imports section but still no luck, does anyone face this issue to fix the test