import { Component, Input } from '@angular/core'; import { TestBed, waitForAsync, ComponentFixture } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { provideMockStore, MockStore } from '@ngrx/store/testing'; import { WelcomeComponent } from './welcome.component'; import { AppConfigService } from 'src/app/app-config.service'; describe('WelcomeComponent', () => { let component: WelcomeComponent; let fixture: ComponentFixture<WelcomeComponent>; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ imports: [RouterTestingModule], declarations: [WelcomeComponent] }).compileComponents(); fixture = TestBed.createComponent(WelcomeComponent); component = fixture.componentInstance; })); it('should create the component', () => { expect(component).toBeDefined(); }); it('#getLogoSrc() should return logo URL address', () => { component.apiUrl = 'http://test.com'; component.instance = { name: 'myInstance', label: 'My Instance', data_path: 'data/path', config: { design: { design_color: 'green', design_background_color: 'darker green', design_logo: 'path/to/logo', design_favicon: 'path/to/favicon' }, home: { home_component: 'HomeComponent', home_config: { home_component_text: 'Description', home_component_logo: 'path/to/logo' } }, search: { search_by_criteria_allowed: true, search_by_criteria_label: 'Search', search_multiple_allowed: true, search_multiple_label: 'Search multiple', search_multiple_all_datasets_selected: true }, documentation: { documentation_allowed: true, documentation_label: 'Documentation' } }, nb_dataset_families: 1, nb_datasets: 2 }; expect(component.getLogoSrc()).toBe('http://test.com/download-instance-file/myInstance/path/to/logo'); }); });