1 import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
2 import { of } from 'rxjs';
3 import { NvmeofGatewayComponent } from './nvmeof-gateway.component';
4 import { NvmeofService } from '../../../shared/api/nvmeof.service';
5 import { HttpClientModule } from '@angular/common/http';
6 import { SharedModule } from '~/app/shared/shared.module';
12 name: 'client.nvmeof.rbd.ceph-node-01.jnmnwa',
14 addr: '192.168.100.101',
16 load_balancing_group: 1,
21 class MockNvmeOfService {
23 return of(mockGateways);
27 describe('NvmeofGatewayComponent', () => {
28 let component: NvmeofGatewayComponent;
29 let fixture: ComponentFixture<NvmeofGatewayComponent>;
31 beforeEach(fakeAsync(() => {
32 TestBed.configureTestingModule({
33 declarations: [NvmeofGatewayComponent],
34 imports: [HttpClientModule, SharedModule],
35 providers: [{ provide: NvmeofService, useClass: MockNvmeOfService }]
36 }).compileComponents();
40 fixture = TestBed.createComponent(NvmeofGatewayComponent);
41 component = fixture.componentInstance;
44 it('should create', () => {
45 expect(component).toBeTruthy();
48 it('should retrieve gateways', fakeAsync(() => {
49 component.getGateways();
51 expect(component.gateways).toEqual(mockGateways);