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

OZG-7000 CR

parent e9ec2957
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@
*/
import { ApiRootLinkRel, ApiRootResource, ApiRootService } from '@alfa-client/api-root-shared';
import { BuildInfoComponent } from '@alfa-client/common';
import { Environment } from '@alfa-client/environment-shared';
import { getEnvironmentFactory } from '@alfa-client/environment-shared';
import { HasLinkPipe, createEmptyStateResource, createStateResource } from '@alfa-client/tech-shared';
import {
Mock,
......@@ -45,14 +45,16 @@ import {
} from '@ods/system';
import { AuthenticationService } from 'authentication';
import { createApiRootResource } from 'libs/api-root-shared/test/api-root';
import { createEnvironment } from 'libs/environment-shared/test/environment';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { MockComponent, MockDirective } from 'ng-mocks';
import { of } from 'rxjs';
import { createEnvironment } from '../../../../libs/environment-shared/test/environment';
import { UserProfileButtonContainerComponent } from '../common/user-profile-button-container/user-profile.button-container.component';
import { UnavailablePageComponent } from '../pages/unavailable/unavailable-page/unavailable-page.component';
import { AppComponent } from './app.component';
jest.mock('@alfa-client/environment-shared');
describe('AppComponent', () => {
let component: AppComponent;
let fixture: ComponentFixture<AppComponent>;
......@@ -67,7 +69,8 @@ describe('AppComponent', () => {
const logoLink: string = getDataTestIdOf('logo-link');
const routerOutletSelector: string = getDataTestIdOf('router-outlet');
let environment: Environment;
const environment = createEnvironment();
(getEnvironmentFactory as jest.Mock).mockReturnValue(environment);
const authenticationService: Mock<AuthenticationService> = {
...mock(AuthenticationService),
......@@ -127,9 +130,6 @@ describe('AppComponent', () => {
});
beforeEach(() => {
environment = createEnvironment();
window['__env__'] = environment;
fixture = TestBed.createComponent(AppComponent);
component = fixture.componentInstance;
});
......
......@@ -28,6 +28,7 @@ import { existsAsHtmlElement, mock, Mock, notExistsAsHtmlElement } from '@alfa-c
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { createApiRootResource } from 'libs/api-root-shared/test/api-root';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { singleColdCompleted } from 'libs/tech-shared/test/marbles';
import { MockComponent } from 'ng-mocks';
import { of } from 'rxjs';
import { OrganisationsEinheitFormPageComponent } from './organisationseinheit-form-page.component';
......@@ -63,7 +64,8 @@ describe('OrganisationsEinheitFormPageComponent', () => {
describe('component', () => {
describe('ngOnInit', () => {
const apiRootStateResource$ = of(createStateResource(createApiRootResource()));
const apiRootStateResource = createStateResource(createApiRootResource());
const apiRootStateResource$ = of(apiRootStateResource);
beforeEach(() => {
apiRootService.getApiRoot.mockReturnValue(apiRootStateResource$);
......@@ -78,7 +80,7 @@ describe('OrganisationsEinheitFormPageComponent', () => {
it('should get apiRootStateResource$', () => {
component.ngOnInit();
expect(component.apiRootStateResource$).toBe(apiRootStateResource$);
expect(component.apiRootStateResource$).toBeObservable(singleColdCompleted(apiRootStateResource));
});
});
});
......
......@@ -26,10 +26,11 @@ import { ApiRootLinkRel, ApiRootService } from '@alfa-client/api-root-shared';
import { createStateResource, TechSharedModule } from '@alfa-client/tech-shared';
import { existsAsHtmlElement, mock, Mock, notExistsAsHtmlElement } from '@alfa-client/test-utils';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { createApiRootResource } from 'libs/api-root-shared/test/api-root';
import { getDataTestIdOf } from 'libs/tech-shared/test/data-test';
import { singleColdCompleted } from 'libs/tech-shared/test/marbles';
import { MockComponent } from 'ng-mocks';
import { of } from 'rxjs';
import { createApiRootResource } from '../../../../../../libs/api-root-shared/test/api-root';
import { getDataTestIdOf } from '../../../../../../libs/tech-shared/test/data-test';
import { OrganisationsEinheitPageComponent } from './organisationseinheit-page.component';
describe('OrganisationsEinheitPageComponent', () => {
......@@ -63,7 +64,8 @@ describe('OrganisationsEinheitPageComponent', () => {
describe('component', () => {
describe('ngOnInit', () => {
const apiRootStateResource$ = of(createStateResource(createApiRootResource()));
const apiRootStateResource = createStateResource(createApiRootResource());
const apiRootStateResource$ = of(apiRootStateResource);
beforeEach(() => {
apiRootService.getApiRoot.mockReturnValue(apiRootStateResource$);
......@@ -78,7 +80,7 @@ describe('OrganisationsEinheitPageComponent', () => {
it('should get apiRootStateResource$', () => {
component.ngOnInit();
expect(component.apiRootStateResource$).toBe(apiRootStateResource$);
expect(component.apiRootStateResource$).toBeObservable(singleColdCompleted(apiRootStateResource));
});
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment