1 import { ComponentFixture, TestBed } from '@angular/core/testing';
3 import { SmbClusterTabsComponent } from './smb-cluster-tabs.component';
4 import { RESOURCE_TYPE, SMBCluster } from '../smb.model';
5 import { By } from '@angular/platform-browser';
7 describe('SmbClusterTabsComponent', () => {
8 let component: SmbClusterTabsComponent;
9 let fixture: ComponentFixture<SmbClusterTabsComponent>;
11 beforeEach(async () => {
12 await TestBed.configureTestingModule({
13 declarations: [SmbClusterTabsComponent]
14 }).compileComponents();
16 fixture = TestBed.createComponent(SmbClusterTabsComponent);
17 component = fixture.componentInstance;
18 fixture.detectChanges();
21 it('should create', () => {
22 expect(component).toBeTruthy();
25 it('should not render anything if selection is falsy', () => {
26 component.selection = null;
27 fixture.detectChanges();
29 const tabsElement = fixture.debugElement.query(By.css('cds-tabs'));
30 expect(tabsElement).toBeNull();
33 const selectedSmbCluster = (clusterId: string) => {
34 const smbCluster: SMBCluster = {
35 resource_type: RESOURCE_TYPE,
36 cluster_id: clusterId,
42 it('should render cds-tabs if selection is truthy', () => {
43 component.selection = selectedSmbCluster('fooBar');
44 fixture.detectChanges();
46 const tabsElement = fixture.debugElement.query(By.css('cds-tabs'));
47 expect(tabsElement).toBeTruthy();