Skip to content

Commit

Permalink
Fix frontend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lkleisa committed Dec 1, 2023
1 parent 4931203 commit a010189
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import { MatInputModule } from '@angular/material/input';
import { MatRadioModule } from '@angular/material/radio';
import { Unit } from '../../../types/enums/Unit';
import { ParseUnitValuePipe } from '../../../pipes/parse-unit-value/parse-unit-value.pipe';
import { TranslateService } from '@ngx-translate/core';
import { TranslateTestingModule } from 'ngx-translate-testing';
import * as de from '../../../../../assets/i18n/de.json';

describe('CheckInFormComponent', () => {
let component: CheckInFormMetricComponent;
Expand All @@ -25,6 +28,9 @@ describe('CheckInFormComponent', () => {
MatInputModule,
MatRadioModule,
ReactiveFormsModule,
TranslateTestingModule.withTranslations({
de: de,
}),
],
declarations: [CheckInFormMetricComponent, UnitValueTransformationPipe],
providers: [UnitValueTransformationPipe, ParseUnitValuePipe],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import { ParseUnitValuePipe } from '../../../pipes/parse-unit-value/parse-unit-v
import { CheckInService } from '../../../services/check-in.service';
import { of } from 'rxjs';
import { ActionService } from '../../../services/action.service';
import { TranslateService } from '@ngx-translate/core';
import * as de from '../../../../../assets/i18n/de.json';
import { TranslateTestingModule } from 'ngx-translate-testing';

const dialogMock = {
close: jest.fn(),
Expand Down Expand Up @@ -52,6 +55,9 @@ describe('CheckInFormComponent', () => {
MatInputModule,
NoopAnimationsModule,
MatCheckboxModule,
TranslateTestingModule.withTranslations({
de: de,
}),
],
providers: [
{ provide: MAT_DIALOG_DATA, useValue: { keyResult: {} } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CompleteDialogComponent } from './complete-dialog.component';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { DialogHeaderComponent } from '../../custom/dialog-header/dialog-header.component';
import { TranslateService } from '@ngx-translate/core';

const dialogMock = {
close: jest.fn(),
Expand All @@ -25,6 +26,7 @@ describe('CompleteDialogComponent', () => {
providers: [
{ provide: MatDialogRef, useValue: dialogMock },
{ provide: MAT_DIALOG_DATA, useValue: matDataMock },
{ provide: TranslateService, useValue: {} },
],
});
fixture = TestBed.createComponent(CompleteDialogComponent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { KeyResultFormComponent } from '../key-result-form/key-result-form.compo
import { Action } from '../../types/model/Action';
import { KeyResultMetric } from '../../types/model/KeyResultMetric';
import { KeyResultOrdinal } from '../../types/model/KeyResultOrdinal';
import { TranslateTestingModule } from 'ngx-translate-testing';
import * as de from '../../../../assets/i18n/de.json';

describe('KeyResultFormComponent', () => {
let component: KeyResultFormComponent;
Expand Down Expand Up @@ -100,6 +102,9 @@ describe('KeyResultFormComponent', () => {
MatIconModule,
TranslateModule.forRoot(),
DragDropModule,
TranslateTestingModule.withTranslations({
de: de,
}),
],
providers: [
KeyresultService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import { By } from '@angular/platform-browser';
import { MatCheckboxHarness } from '@angular/material/checkbox/testing';
import { RouterTestingHarness, RouterTestingModule } from '@angular/router/testing';
import { DialogHeaderComponent } from '../../custom/dialog-header/dialog-header.component';
import { TranslateService } from '@ngx-translate/core';
import { TranslateTestingModule } from 'ngx-translate-testing';
import * as de from '../../../../assets/i18n/de.json';

let objectiveService = {
getFullObjective: jest.fn(),
Expand Down Expand Up @@ -78,6 +81,9 @@ describe('ObjectiveDialogComponent', () => {
NoopAnimationsModule,
MatCheckboxModule,
RouterTestingModule,
TranslateTestingModule.withTranslations({
de: de,
}),
],
declarations: [ObjectiveFormComponent, DialogHeaderComponent],
providers: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { of } from 'rxjs';
import { organisationActive, organisationInActive, teamFormObject, teamMin1 } from '../../testData';
import { Team } from '../../types/model/Team';
import { OrganisationService } from '../../services/organisation.service';
import { TranslateService } from '@ngx-translate/core';

const dialogRefMock = {
close: jest.fn(),
Expand Down Expand Up @@ -79,6 +80,7 @@ describe('TeamManagementComponent', () => {
provide: MAT_DIALOG_DATA,
useValue: null,
},
{ provide: TranslateService, useValue: {} },
],
});
fixture = TestBed.createComponent(TeamManagementComponent);
Expand Down

0 comments on commit a010189

Please sign in to comment.