title: `TypeError: Cannot read property 'dispatchEvent' of null` - angular test with jest
body: <p>I am getting an error as <code>TypeError: Cannot read property 'dispatchEvent' of null</code> on testing the component. here is my code :</p>
  
  <pre><code>describe('SubSystemComponent', () =&gt; {
  
      let component: SubSystemComponent;
      let fixture: ComponentFixture&lt;SubSystemComponent&gt;;
      let store: Store&lt;ModelPFServices&gt;;
  
  
      beforeEach(async(() =&gt; {
          TestBed.configureTestingModule({
              declarations: [SubSystemComponent],
              schemas: [CUSTOM_ELEMENTS_SCHEMA],
              imports: [
                  HttpClientTestingModule,
                  FormsModule,
                  ReactiveFormsModule,
                  StoreModule.forRoot({}, { runtimeChecks: { strictStateImmutability: true, strictActionImmutability: true } }),
                  StoreModule.forFeature('pfservice', reducer),
                  EffectsModule.forRoot([]),
                  EffectsModule.forFeature([EffectsSubSystem])
              ]
          })
          .compileComponents();
  
          store = TestBed.get(Store);
          spyOn(store, 'dispatch').and.callThrough();
  
  
      }));
  
      beforeEach(() =&gt; {
          fixture = TestBed.createComponent(SubSystemComponent);
          component = fixture.componentInstance;
          spyOn(component.ssRemoved, 'emit');
          fixture.detectChanges();
      });
  
      it('should create', () =&gt; {
          expect(component).toBeTruthy();
      });
  
      it('should delete a id', () =&gt; {
  //this part shows error
          const nativeElement = fixture.nativeElement;
          const button = nativeElement.querySelector('.delete-item');
          button.dispatchEvent(new MouseEvent('click'));
          fixture.detectChanges();
  
      });
  
  });
  </code></pre>
  
  <p>what is wrong with my code or how to fix this? any one help me?</p>