Skip to content
Snippets Groups Projects
Commit 446ef8db authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6731 OZG 6763 sort users

parent 98506728
Branches
Tags
No related merge requests found
...@@ -4,8 +4,8 @@ import { OrganisationseinheitError, OrganisationseinheitErrorType } from './user ...@@ -4,8 +4,8 @@ import { OrganisationseinheitError, OrganisationseinheitErrorType } from './user
import { import {
KEYCLOAK_ERROR_MESSAGES, KEYCLOAK_ERROR_MESSAGES,
UserNamePipe, UserNamePipe,
sortUsersByLastName,
getOrganisationseinheitErrorMessage, getOrganisationseinheitErrorMessage,
sortUsersByLastName,
} from './user.util'; } from './user.util';
describe('user util', () => { describe('user util', () => {
...@@ -28,23 +28,6 @@ describe('user util', () => { ...@@ -28,23 +28,6 @@ describe('user util', () => {
}); });
}); });
describe('sort users by last name', () => {
const users: UserRepresentation[] = [
{ id: '1', lastName: 'Müller' },
{ id: '2', lastName: 'Schmidt' },
{ id: '3', lastName: 'Anders' },
];
it('shoud sort users by last name alphabetically ', () => {
const sortedUsers = sortUsersByLastName(users);
expect(sortedUsers[0].lastName).toBe('Anders');
expect(sortedUsers[1].lastName).toBe('Müller');
expect(sortedUsers[2].lastName).toBe('Schmidt');
});
});
});
describe('UserNamePipe', () => { describe('UserNamePipe', () => {
it('should return user name', () => { it('should return user name', () => {
const user: UserRepresentation = { firstName: 'Max', lastName: 'Mustermann' }; const user: UserRepresentation = { firstName: 'Max', lastName: 'Mustermann' };
...@@ -62,4 +45,20 @@ describe('user util', () => { ...@@ -62,4 +45,20 @@ describe('user util', () => {
expect(result).toBe('Unbekannter Benutzer'); expect(result).toBe('Unbekannter Benutzer');
}); });
}); });
describe('sort users by last name', () => {
const users: UserRepresentation[] = [
{ id: '1', lastName: 'Müller' },
{ id: '2', lastName: 'Schmidt' },
{ id: '3', lastName: 'Anders' },
];
it('shoud sort users by last name alphabetically ', () => {
const sortedUsers = sortUsersByLastName(users);
expect(sortedUsers[0].lastName).toBe('Anders');
expect(sortedUsers[1].lastName).toBe('Müller');
expect(sortedUsers[2].lastName).toBe('Schmidt');
});
});
}); });
import UserRepresentation from '@keycloak/keycloak-admin-client/lib/defs/userRepresentation';
import { Pipe, PipeTransform } from '@angular/core'; import { Pipe, PipeTransform } from '@angular/core';
import UserRepresentation from '@keycloak/keycloak-admin-client/lib/defs/userRepresentation'; import UserRepresentation from '@keycloak/keycloak-admin-client/lib/defs/userRepresentation';
import { OrganisationseinheitError, OrganisationseinheitErrorType } from './user.model'; import { OrganisationseinheitError, OrganisationseinheitErrorType } from './user.model';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment