我想在触发更改检测之前调用created spy方法.这是我的模拟课.
const stubStudentService: Pick<StudentsCrudService, keyof StudentsCrudService> =
{
getAllStudents: jasmine
.createSpy('getAllStudents')
.and.returnValue(of(studentPayload)),
...other methods
};
我怎么称呼fixture.detectChanges()
之前的getAllStudents
beforeEach(() => {
fixture = TestBed.createComponent(StudentsListComponent);
component = fixture.componentInstance;
<-- want to call that spy here --->
fixture.detectChanges();
});
我想这么做是因为这个问题.但根据我的模拟服务https://stackoverflow.com/questions/69989284/...,我不知道如何改变解决方案