const todosServiceStub = {
get() {
const todos = [{id: 1}];
return of( todos );
}
};
describe('TodosComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [ TodosComponent ],
providers: [{provide: TodosService, useValue: todosServiceStub}]
})
});
it('should...', () => {
fixture.detectChanges();
expect(element.querySelectorAll('.todo').length).toEqual(1);
});
});