Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Cannot read property 'textContent' of null

Estou recebendo a mensagem: TypeError: Cannot read property 'textContent' of null, neste teste:

  it(`Should display number of likes when (@Input likes) is incremented`, () => {
      fixture.detectChanges();
      component.likes++;
      fixture.detectChanges();
      const element = fixture.nativeElement.querySelector('.like-counter');
      expect(element.textContent.trim()).toBe('1');
    })

reparei no console alguns erros também

ERROR: 'NG0304: 'app-like-widget' is not a known element:
1. If 'app-like-widget' is an Angular component, then verify that it is part of this module.
2. If 'app-like-widget' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.'

Alguém poderia em dar um help ?

1 resposta
solução!

Resolvido.

Faltou adicionar a importação do módulo do like-widget.

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