Я использую angular 9 и заменил стандартное модульное тестирование angular на зрителя и шутку после глубокого исследования, это интересно, и у меня есть несколько тестов, которые работают нормально, но внезапно у меня возникает эта проблема при попытке проверить некоторые родительский компонент, приводящий к ужасной ошибке (см. заголовок вопроса), которую я не могу понять, как ее устранить, будет рад некоторой помощи, код ниже
, другие подобные тесты работают, но этот становится недружественным Сообщение в заголовке, даже когда я удаляю всю разметку шаблона и пишу просто глупый div, и отменяю насмешку в тесте, я все еще получаю этот облом ... попытался перезапустить серверы без посторонней помощи.
spe c .ts
import { Spectator, createComponentFactory } from '@ngneat/spectator/jest';
import { PlannerScreenComponent } from './planner-screen.component';
import { SlotsListComponent } from '../planner/components/slots-list/slots-list.component';
import { MockComponent } from 'ng-mocks';
describe('PlannerScreenComponent suit', () => {
let spectator: Spectator<PlannerScreenComponent>;
const createComponent: () => Spectator<PlannerScreenComponent> = createComponentFactory({
component: PlannerScreenComponent,
declarations: [MockComponent(SlotsListComponent)]
});
beforeEach(() => (spectator = createComponent()));
it('should create plannerScreenComponent ', () => {
const plannerScreenComponent = spectator.component;
expect(plannerScreenComponent).toBeTruthy();
});
});
component.ts
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'planner-screen',
templateUrl: './planner-screen.component.html',
styleUrls: ['./planner-screen.component.scss']
})
export class PlannerScreenComponent implements OnInit {
@Input() isSplittedScreen = false;
constructor() {}
ngOnInit() {}
}
component. html
section [class.splitted-screen]="isSplittedScreen" class="planner-screen-wrapper">
<aside class="left-ruller-container"></aside>
<div class="top-middle-title">
<div>title</div>
</div>
<div class="main-panel-container">
<slots-list></slots-list>
</div>
<aside class="right-ruller-container"></aside>
</section>