Search code examples
angularunit-testingjestjsckeditor

How to mock import dependency(ckeditor) with jest mock in angular


I need to import CKEditorModule in my test(if I directly import it jest cannot parse), how can I mock it using jest.mock?

import { ComponentFixture, TestBed } from '@angular/core/testing';
import { myComponent } from './myComponent';
import { FormsModule } from '@angular/forms';

describe('myComponent', () => {
  let component: myComponent;
  let fixture: ComponentFixture<myComponent>;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      declarations: [myComponent],
      imports: [FormsModule]
    })
      .compileComponents();
  });

  beforeEach(() => {
    fixture = TestBed.createComponent(myComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});


Solution

  • Ok. Ignored it with NO_ERRORS_SCHEMA