| 
 | 1 | +/**  | 
 | 2 | + * Copyright 2023 Google LLC  | 
 | 3 | + *  | 
 | 4 | + * Licensed under the Apache License, Version 2.0 (the "License");  | 
 | 5 | + * you may not use this file except in compliance with the License.  | 
 | 6 | + * You may obtain a copy of the License at  | 
 | 7 | + *  | 
 | 8 | + *     https://www.apache.org/licenses/LICENSE-2.0  | 
 | 9 | + *  | 
 | 10 | + * Unless required by applicable law or agreed to in writing, software  | 
 | 11 | + * distributed under the License is distributed on an "AS IS" BASIS,  | 
 | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  | 
 | 13 | + * See the License for the specific language governing permissions and  | 
 | 14 | + * limitations under the License.  | 
 | 15 | + */  | 
 | 16 | +import { ComponentFixture, TestBed } from '@angular/core/testing';  | 
 | 17 | + | 
 | 18 | +import { RiskAssessmentComponent } from './risk-assessment.component';  | 
 | 19 | +import { MatToolbarModule } from '@angular/material/toolbar';  | 
 | 20 | +import { BrowserAnimationsModule } from '@angular/platform-browser/animations';  | 
 | 21 | + | 
 | 22 | +describe('RiskAssessmentComponent', () => {  | 
 | 23 | +  let component: RiskAssessmentComponent;  | 
 | 24 | +  let fixture: ComponentFixture<RiskAssessmentComponent>;  | 
 | 25 | +  let compiled: HTMLElement;  | 
 | 26 | + | 
 | 27 | +  beforeEach(async () => {  | 
 | 28 | +    await TestBed.configureTestingModule({  | 
 | 29 | +      declarations: [RiskAssessmentComponent],  | 
 | 30 | +      imports: [MatToolbarModule, BrowserAnimationsModule],  | 
 | 31 | +    }).compileComponents();  | 
 | 32 | + | 
 | 33 | +    fixture = TestBed.createComponent(RiskAssessmentComponent);  | 
 | 34 | +    component = fixture.componentInstance;  | 
 | 35 | +    compiled = fixture.nativeElement as HTMLElement;  | 
 | 36 | +    fixture.detectChanges();  | 
 | 37 | +  });  | 
 | 38 | + | 
 | 39 | +  it('should create', () => {  | 
 | 40 | +    expect(component).toBeTruthy();  | 
 | 41 | +  });  | 
 | 42 | + | 
 | 43 | +  it('should have toolbar with title', () => {  | 
 | 44 | +    const toolbarEl = compiled.querySelector('.risk-assessment-toolbar');  | 
 | 45 | +    const title = compiled.querySelector('h2.title');  | 
 | 46 | +    const titleContent = title?.innerHTML.trim();  | 
 | 47 | + | 
 | 48 | +    expect(toolbarEl).not.toBeNull();  | 
 | 49 | +    expect(title).toBeTruthy();  | 
 | 50 | +    expect(titleContent).toContain('Risk assessment');  | 
 | 51 | +  });  | 
 | 52 | +});  | 
0 commit comments