Layanan Loader Tampilkan Sembunyikan Unit Test Angular
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SpinnerComponent } from './spinner.component';
import { of } from 'rxjs/observable/of';
describe('SpinnerComponent', () => {
let component: SpinnerComponent;
let fixture: ComponentFixture<SpinnerComponent>;
const fakeSpinner = {
spinnerState: of({ show: false }),
};
beforeEach(
async(() => {
TestBed.configureTestingModule({
declarations: [SpinnerComponent],
providers: [{ provide: SpinnerService, useValue: fakeSpinner }],
}).compileComponents();
}),
);
beforeEach(() => {
fixture = TestBed.createComponent(SpinnerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should set component.visible based on spinnerService state', () => {
expect(component.visible).toEqual(false)
});
});
Panicky Peafowl