Skip to content
Snippets Groups Projects
Commit 0c0b1c89 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4310 missing tests

parent a404fbda
No related branches found
No related tags found
No related merge requests found
...@@ -68,6 +68,26 @@ describe('UserAddFormService', () => { ...@@ -68,6 +68,26 @@ describe('UserAddFormService', () => {
}); });
}); });
describe('disableUncheckedCheckboxes', () => {
it('if control value is false then control should be disabled', () => {
const control: AbstractControl = alfaGroup.get(UserAddFormService.LOESCHEN);
control.setValue(false);
formService.disableUncheckedCheckboxes(alfaGroup);
expect(control.disabled).toBe(true);
});
it('if control value is true then control should NOT be disabled', () => {
const control: AbstractControl = alfaGroup.get(UserAddFormService.LOESCHEN);
control.setValue(true);
formService.disableUncheckedCheckboxes(alfaGroup);
expect(control.disabled).toBe(false);
});
});
describe('updateCheckboxStates', () => { describe('updateCheckboxStates', () => {
it('if control value is false then control should be disabled', () => { it('if control value is false then control should be disabled', () => {
const control: AbstractControl = alfaGroup.get(UserAddFormService.LOESCHEN); const control: AbstractControl = alfaGroup.get(UserAddFormService.LOESCHEN);
......
import { createStateResource } from '@alfa-client/tech-shared';
import { Mock, mock } from '@alfa-client/test-utils'; import { Mock, mock } from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
...@@ -5,6 +6,7 @@ import { ButtonWithSpinnerComponent } from '@ods/component'; ...@@ -5,6 +6,7 @@ import { ButtonWithSpinnerComponent } from '@ods/component';
import { MailboxIconComponent, PersonIconComponent } from '@ods/system'; import { MailboxIconComponent, PersonIconComponent } from '@ods/system';
import { MockComponent, MockPipe } from 'ng-mocks'; import { MockComponent, MockPipe } from 'ng-mocks';
import { ROUTES } from '../../../../shared'; import { ROUTES } from '../../../../shared';
import { createUser } from '../../../test/user/user';
import { ToUserNamePipe } from '../user/to-user-name.pipe'; import { ToUserNamePipe } from '../user/to-user-name.pipe';
import { UserService } from './user.service'; import { UserService } from './user.service';
import { UsersRolesComponent } from './users-roles.component'; import { UsersRolesComponent } from './users-roles.component';
...@@ -40,6 +42,17 @@ describe('UsersRolesComponent', () => { ...@@ -40,6 +42,17 @@ describe('UsersRolesComponent', () => {
}); });
describe('component', () => { describe('component', () => {
describe('ngOnInit', () => {
it('should get users from userService', () => {
const userState = createStateResource([createUser()]);
userService.get.mockReturnValueOnce(userState);
component.ngOnInit();
expect(component.users$).toBe(userState);
});
});
describe('navigateToAddUser', () => { describe('navigateToAddUser', () => {
it('should navigate to add user', () => { it('should navigate to add user', () => {
const routerSpy = jest.spyOn(router as any, 'navigate'); const routerSpy = jest.spyOn(router as any, 'navigate');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment