Skip to content
Snippets Groups Projects
Commit 2b862bbe authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4310 fix tests

parent c6f6e596
No related branches found
No related tags found
No related merge requests found
import { UserAddFormComponent } from '@admin-client/admin-settings';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MockComponent } from 'ng-mocks';
import { UserAddPageComponent } from './user-add-page.component';
describe('UserAddPageComponent', () => {
......@@ -7,7 +9,7 @@ describe('UserAddPageComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [UserAddPageComponent],
declarations: [UserAddPageComponent, MockComponent(UserAddFormComponent)],
}).compileComponents();
fixture = TestBed.createComponent(UserAddPageComponent);
......
<ods-checkbox
[fieldControl]="control.control"
[fieldControl]="fieldControl"
[inputId]="inputId"
[label]="label"
[disabled]="control.disabled"
......
......@@ -3,6 +3,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { faker } from '@faker-js/faker';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { createInvalidParam } from 'libs/tech-shared/test/error';
import { MockNgControl } from '../../../../test/form/MockNgControl';
import { CheckboxEditorComponent } from './checkbox-editor.component';
describe('CheckboxEditorComponent', () => {
......@@ -20,6 +21,7 @@ describe('CheckboxEditorComponent', () => {
fixture = TestBed.createComponent(CheckboxEditorComponent);
component = fixture.componentInstance;
component.label = labelText;
component.control = new MockNgControl();
fixture.detectChanges();
});
......
import { Injectable } from '@angular/core';
import { AbstractControl, ControlValueAccessor, NgControl, UntypedFormControl } from '@angular/forms';
@Injectable()
export class MockNgControl extends NgControl {
valueAccessor: ControlValueAccessor | null = null;
get control(): AbstractControl {
return new UntypedFormControl(null);
}
viewToModelUpdate(newValue: any): void {}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment