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

OZG-5012 adjust admin app

parent 1f16f62c
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,6 @@ export class ConfigurationService { ...@@ -24,7 +24,6 @@ export class ConfigurationService {
return { return {
resource: this.apiRootService.getApiRoot(), resource: this.apiRootService.getApiRoot(),
getLinkRel: ApiRootLinkRel.CONFIGURATION, getLinkRel: ApiRootLinkRel.CONFIGURATION,
editLinkRel: null,
}; };
} }
......
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { OrganisationseinheitContainerComponent } from './organisationseinheit-container.component';
import { OrganisationseinheitFormComponent } from './organisationseinheit-form/organisationseinheit-form.component';
import { MockComponent } from 'ng-mocks';
import { SecondaryButtonComponent } from '../../shared/secondary-button/secondary-button.component';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { import {
Mock,
dispatchEventFromFixture, dispatchEventFromFixture,
existsAsHtmlElement, existsAsHtmlElement,
getElementFromFixtureByType, getElementFromFixtureByType,
mock, mock,
Mock,
notExistsAsHtmlElement, notExistsAsHtmlElement,
} from '@alfa-client/test-utils'; } from '@alfa-client/test-utils';
import { OrganisationseinheitListComponent } from './organisationseinheit-list/organisationseinheit-list.component'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { UserService } from '../../user/user.service'; import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { MockComponent } from 'ng-mocks';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { singleCold } from '../../../../../tech-shared/test/marbles';
import { import {
createOrganisationseinheit, createOrganisationseinheit,
createOrganisationseinheitState, createOrganisationseinheitState,
} from '../../../../test/user/user'; } from '../../../../test/user/user';
import { Organisationseinheit } from '../../user/user.model'; import { SecondaryButtonComponent } from '../../shared/secondary-button/secondary-button.component';
import { singleCold } from '../../../../../tech-shared/src/lib/resource/marbles';
import { SpinnerComponent } from '../../shared/spinner/spinner.component'; import { SpinnerComponent } from '../../shared/spinner/spinner.component';
import { Organisationseinheit } from '../../user/user.model';
import { UserService } from '../../user/user.service';
import { OrganisationseinheitContainerComponent } from './organisationseinheit-container.component';
import { OrganisationseinheitFormComponent } from './organisationseinheit-form/organisationseinheit-form.component';
import { OrganisationseinheitListComponent } from './organisationseinheit-list/organisationseinheit-list.component';
describe('OrganisationseinheitContainerComponent', () => { describe('OrganisationseinheitContainerComponent', () => {
let component: OrganisationseinheitContainerComponent; let component: OrganisationseinheitContainerComponent;
......
import { ApiResourceService, ResourceRepository } from '@alfa-client/tech-shared'; import {
import { PostfachResource } from './postfach.model'; ApiResourceService,
ResourceRepository,
ResourceServiceConfig,
} from '@alfa-client/tech-shared';
import { SettingsService } from '../admin-settings.service'; import { SettingsService } from '../admin-settings.service';
import { PostfachLinkRel } from './postfach.linkrel'; import { PostfachLinkRel } from './postfach.linkrel';
import { PostfachResource } from './postfach.model';
export class PostfachResourceService extends ApiResourceService< export class PostfachResourceService extends ApiResourceService<
PostfachResource, PostfachResource,
...@@ -15,10 +19,10 @@ export function postfachResourceServiceFactory( ...@@ -15,10 +19,10 @@ export function postfachResourceServiceFactory(
return new ApiResourceService(buildConfig(settingService), repository); return new ApiResourceService(buildConfig(settingService), repository);
} }
function buildConfig(settingService: SettingsService) { function buildConfig(settingService: SettingsService): ResourceServiceConfig<PostfachResource> {
return { return {
resource: settingService.getPostfach(), resource: settingService.getPostfach(),
getLinkRel: PostfachLinkRel.SELF, getLinkRel: PostfachLinkRel.SELF,
editLinkRel: PostfachLinkRel.SELF, edit: { linkRel: PostfachLinkRel.SELF },
}; };
} }
import {
HttpError,
StateResource,
createStateResource,
mockResourceService,
} from '@alfa-client/tech-shared';
import { Mock, useFromMock } from '@alfa-client/test-utils'; import { Mock, useFromMock } from '@alfa-client/test-utils';
import { PostfachResource, PostfachSettingsItem } from './postfach.model';
import { PostfachService } from './postfach.service';
import { createPostfachResource, createPostfachSettingItem } from '../../../test/postfach/postfach';
import { createStateResource, HttpError, StateResource } from '@alfa-client/tech-shared';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { singleCold, singleHot } from '../../../../tech-shared/test/marbles'; import { singleCold, singleHot } from '../../../../tech-shared/test/marbles';
import { createPostfachResource, createPostfachSettingItem } from '../../../test/postfach/postfach';
import { PostfachResourceService } from './postfach-resource.service'; import { PostfachResourceService } from './postfach-resource.service';
import { mockResourceService } from '../../../../tech-shared/test/resource'; import { PostfachResource, PostfachSettingsItem } from './postfach.model';
import { PostfachService } from './postfach.service';
describe('PostfachService', () => { describe('PostfachService', () => {
let service: PostfachService; let service: PostfachService;
......
import { UserService } from './user.service';
import { UserRepository } from './user.repository.service';
import { mock, Mock, useFromMock } from '@alfa-client/test-utils'; import { mock, Mock, useFromMock } from '@alfa-client/test-utils';
import { fakeAsync, tick } from '@angular/core/testing';
import { cold } from 'jest-marbles';
import { firstValueFrom, lastValueFrom, Observable, of } from 'rxjs';
import { singleCold } from '../../../../tech-shared/test/marbles';
import { import {
createOrganisationseinheit, createOrganisationseinheit,
createOrganisationseinheitState, createOrganisationseinheitState,
} from '../../../test/user/user'; } from '../../../test/user/user';
import { firstValueFrom, lastValueFrom, Observable, of } from 'rxjs';
import { Organisationseinheit } from './user.model'; import { Organisationseinheit } from './user.model';
import { cold } from 'jest-marbles'; import { UserRepository } from './user.repository.service';
import { fakeAsync, tick } from '@angular/core/testing'; import { UserService } from './user.service';
import { singleCold } from '../../../../tech-shared/src/lib/resource/marbles';
describe('UserService', () => { describe('UserService', () => {
let service: UserService; let service: UserService;
......
...@@ -18,7 +18,6 @@ import { ...@@ -18,7 +18,6 @@ import {
createStateResource, createStateResource,
} from './resource.util'; } from './resource.util';
import { Type } from '@angular/core';
import { ResourceService } from './resource.service'; import { ResourceService } from './resource.service';
import * as ResourceUtil from './resource.util'; import * as ResourceUtil from './resource.util';
...@@ -510,10 +509,6 @@ describe('ResourceService', () => { ...@@ -510,10 +509,6 @@ describe('ResourceService', () => {
}); });
}); });
export function mockResourceService<T>(service: Type<T>): Mock<T> {
return <Mock<T>>{ ...mock(service), get: jest.fn(), save: jest.fn() };
}
export class DummyResourceService<B extends Resource, T extends Resource> extends ResourceService< export class DummyResourceService<B extends Resource, T extends Resource> extends ResourceService<
B, B,
T T
......
...@@ -21,8 +21,10 @@ ...@@ -21,8 +21,10 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen * Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen. * unter der Lizenz sind dem Lizenztext zu entnehmen.
*/ */
import { Type } from '@angular/core';
import { Resource, ResourceUri, getEmbeddedResource, getUrl, hasLink } from '@ngxp/rest'; import { Resource, ResourceUri, getEmbeddedResource, getUrl, hasLink } from '@ngxp/rest';
import { isEqual, isNil, isNull } from 'lodash-es'; import { isEqual, isNil, isNull } from 'lodash-es';
import { Mock, mock } from '../../../../test-utils/src/lib/mocking';
import { HttpError } from '../tech.model'; import { HttpError } from '../tech.model';
import { encodeUrlForEmbedding, isNotNull } from '../tech.util'; import { encodeUrlForEmbedding, isNotNull } from '../tech.util';
...@@ -139,3 +141,7 @@ export function isInvalidResourceCombination<T extends Resource, B extends Resou ...@@ -139,3 +141,7 @@ export function isInvalidResourceCombination<T extends Resource, B extends Resou
export function isStateResoureStable<T>(stateResource: StateResource<T>): boolean { export function isStateResoureStable<T>(stateResource: StateResource<T>): boolean {
return !stateResource.loading && !stateResource.reload; return !stateResource.loading && !stateResource.reload;
} }
export function mockResourceService<T>(service: Type<T>): Mock<T> {
return <Mock<T>>{ ...mock(service), get: jest.fn(), save: jest.fn() };
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment