import { ComponentFixture, TestBed } from '@angular/core/testing'; import { CabinetComponent } from './cabinet.component'; import { Board, Cabinet, RawCabinet } from '@creedinteractive/onguard-models'; import { cabinetData } from './rawdata'; const boards = cabinetData.Boards.map((board) => Board.fromRaw(board)); function findGateway(type: string): RawCabinet { return cabinetData.MediaGateways.find((rawCabinet) => rawCabinet.Type === type); } describe('CabinetComponent', () => { let component: CabinetComponent; let fixture: ComponentFixture; beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [CabinetComponent], }).compileComponents(); }); beforeEach(() => { fixture = TestBed.createComponent(CabinetComponent); component = fixture.componentInstance; component.model = Cabinet.fromRaw(findGateway('mcc'), boards); fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); it('should have cabinet data', () => { fixture.detectChanges(); expect(component.model).not.toBeNull(); expect(component.model.slots.length).toEqual(20); }); });