Skip to content

Commit

Permalink
Fix frontend unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelMoeri committed Oct 30, 2024
1 parent 6748b0e commit c93ab09
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ng-container *ngIf="(objective$ | async)?.id && (objective$ | async) as objective; else spinner">
<div *ngIf="objective" class="d-flex flex-column">
<section class="w-100 d-flex justify-content-between align-items-center mb-3">
<h2 class="title">{{ objective.title }}</h2>
<h2 class="title" [attr.data-testId]="'objective-title'">{{ objective.title }}</h2>
<button
class="d-flex align-items-center justify-content-center"
mat-icon-button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ describe('ObjectiveDetailComponent', () => {
it('get data from backend', () => {
fixture.detectChanges();
component.objectiveId = 2;
const title = fixture.debugElement.query(By.css('.title')).nativeElement.innerHTML;
const description = fixture.debugElement.query(By.css('[data-test-id="description"]')).nativeElement.innerHTML;
const title = fixture.debugElement.query(By.css('[data-testId="objective-title"]'))?.nativeElement.innerHTML;
const description = fixture.debugElement.query(By.css('[data-testId="description"]'))?.nativeElement.innerHTML;
expect(title).toContain(objective.title);
expect(description).toContain(objective.description);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
import { ScoringComponent } from '../../shared/custom/scoring/scoring.component';
import { ConfidenceComponent } from '../confidence/confidence.component';
import { ReactiveFormsModule } from '@angular/forms';
// @ts-ignore
import * as de from '../../../assets/i18n/de.json';
import { TranslateTestingModule } from 'ngx-translate-testing';
import { ObjectiveMin } from '../../shared/types/model/ObjectiveMin';
Expand Down

0 comments on commit c93ab09

Please sign in to comment.