import { TestBed, ComponentFixture } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { NavbarComponent } from './navbar.component'; import { INSTANCE } from '../../../test-data'; describe('[Shared][Component] NavbarComponent', () => { let component: NavbarComponent; let fixture: ComponentFixture<NavbarComponent>; beforeEach(() => { TestBed.configureTestingModule({ declarations: [NavbarComponent], imports: [RouterTestingModule] }).compileComponents(); fixture = TestBed.createComponent(NavbarComponent); component = fixture.componentInstance; }); it('should create the component', () => { expect(component).toBeDefined(); }); it('should return logo href', () => { component.apiUrl = 'http://test.com'; component.instance = INSTANCE; expect(component.getLogoHref()).toEqual('http://test.com/download-instance-file/myInstance/path/to/logo'); component.instance.config.design.design_logo = ''; expect(component.getLogoHref()).toEqual('assets/cesam_anis40.png'); }); });