Skip to content

Commit

Permalink
Fix update, adjust tests (#31)
Browse files Browse the repository at this point in the history
* fix: use updated bff, fix some tests

* fix: role update

* fix: contact update

* fix: props update

* fix: work more on tests

* fix: paste all prev used spec files

* fix: use absolute paths in spec files

* fix: use absolute paths in all files

* fix: import tests

* fix: preview tests

---------

Co-authored-by: Christian Badura <[email protected]>
  • Loading branch information
cbadura and Christian Badura authored Feb 23, 2024
1 parent 688bcd6 commit 81e7b06
Show file tree
Hide file tree
Showing 54 changed files with 6,648 additions and 5,229 deletions.
5,102 changes: 3,289 additions & 1,813 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { NO_ERRORS_SCHEMA } from '@angular/core'
import { TestBed } from '@angular/core/testing'
import { AppComponent } from './app.component'
import { RouterTestingModule } from '@angular/router/testing'

import { AppComponent } from 'src/app/app.component'

describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/menu-state.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TestBed } from '@angular/core/testing'
import { HttpClientTestingModule } from '@angular/common/http/testing'

import { MenuStateService } from './menu-state.service'
import { MenuStateService } from 'src/app/services/menu-state.service'

describe('MenuStateService', () => {
let service: MenuStateService
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/menu-state.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core'
import { MenuItem } from '../shared/generated'
import { MenuItem } from 'src/app/shared/generated'

export interface MenuState {
selectedPortal?: string
Expand Down
4 changes: 2 additions & 2 deletions src/app/services/menu-tree.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { TestBed } from '@angular/core/testing'
import { HttpClientTestingModule } from '@angular/common/http/testing'
import { TreeNode } from 'primeng/api'

import { MenuTreeService } from './menu-tree.service'
import { /* MenuItemDetailsDTO, MenuItemStructureDTO, */ MenuItem } from '../shared/generated'
import { MenuTreeService } from 'src/app/services/menu-tree.service'
import { MenuItem } from 'src/app/shared/generated'

describe('MenuTreeService', () => {
let service: MenuTreeService
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/menu-tree.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core'
import { TreeNode } from 'primeng/api'
import { MenuItem } from '../shared/generated'
import { MenuItem } from 'src/app/shared/generated'

export interface NewPosition {
id: string | undefined
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/generated/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ model/createProductRequest.ts
model/createUpdateMenuItem.ts
model/createUpdateMicrofrontend.ts
model/createUpdateProductResponse.ts
model/createWorkspaceMenuItemStructrueRequest.ts
model/createWorkspaceMenuItemStructureRequest.ts
model/createWorkspaceRequest.ts
model/createWorkspaceResponse.ts
model/eximMenuStructure.ts
Expand Down
10 changes: 6 additions & 4 deletions src/app/shared/generated/api/workspace.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import { SearchWorkspacesResponse } from '../model/searchWorkspacesResponse';
// @ts-ignore
import { UpdateWorkspaceRequest } from '../model/updateWorkspaceRequest';
// @ts-ignore
import { Workspace } from '../model/workspace';
// @ts-ignore
import { WorkspaceSnapshot } from '../model/workspaceSnapshot';

// @ts-ignore
Expand Down Expand Up @@ -655,9 +657,9 @@ export class WorkspaceAPIService {
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public updateWorkspace(requestParameters: UpdateWorkspaceRequestParams, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any>;
public updateWorkspace(requestParameters: UpdateWorkspaceRequestParams, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<any>>;
public updateWorkspace(requestParameters: UpdateWorkspaceRequestParams, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<any>>;
public updateWorkspace(requestParameters: UpdateWorkspaceRequestParams, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<Workspace>;
public updateWorkspace(requestParameters: UpdateWorkspaceRequestParams, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpResponse<Workspace>>;
public updateWorkspace(requestParameters: UpdateWorkspaceRequestParams, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<HttpEvent<Workspace>>;
public updateWorkspace(requestParameters: UpdateWorkspaceRequestParams, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable<any> {
const id = requestParameters.id;
if (id === null || id === undefined) {
Expand Down Expand Up @@ -706,7 +708,7 @@ export class WorkspaceAPIService {
}

let localVarPath = `/workspaces/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
return this.httpClient.request<any>('put', `${this.configuration.basePath}${localVarPath}`,
return this.httpClient.request<Workspace>('put', `${this.configuration.basePath}${localVarPath}`,
{
context: localVarHttpContext,
body: updateWorkspaceRequest,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'
import { environment } from '../../../environments/environment'
import { environment } from 'src/environments/environment'

@Component({
selector: 'app-image-container',
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/label.resolver.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Observable, of } from 'rxjs'
import { LabelResolver } from './label.resolver'
import { LabelResolver } from 'src/app/shared/label.resolver'

let labelResolver: LabelResolver

Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {

import { Configuration } from 'src/app/shared/generated'
import { environment } from 'src/environments/environment'
import { LabelResolver } from './label.resolver'
import { LabelResolver } from 'src/app/shared/label.resolver'

import { ImageContainerComponent } from './image-container/image-container.component'
import { ThemeColorBoxComponent } from './theme-color-box/theme-color-box.component'
Expand Down
68 changes: 34 additions & 34 deletions src/app/shared/theme-color-box/theme-color-box.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
// import { NO_ERRORS_SCHEMA } from '@angular/core'
// import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'
// // import { HttpClient } from '@angular/common/http'
// import { HttpClientTestingModule } from '@angular/common/http/testing'
// // import { TranslateLoader, TranslateModule } from '@ngx-translate/core'
import { NO_ERRORS_SCHEMA } from '@angular/core'
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'
// import { HttpClient } from '@angular/common/http'
import { HttpClientTestingModule } from '@angular/common/http/testing'
// import { TranslateLoader, TranslateModule } from '@ngx-translate/core'

// import { ThemeColorBoxComponent } from './theme-color-box.component'
import { ThemeColorBoxComponent } from './theme-color-box.component'

// describe('ThemeColorBoxComponent', () => {
// let component: ThemeColorBoxComponent
// let fixture: ComponentFixture<ThemeColorBoxComponent>
describe('ThemeColorBoxComponent', () => {
let component: ThemeColorBoxComponent
let fixture: ComponentFixture<ThemeColorBoxComponent>

// beforeEach(waitForAsync(() => {
// TestBed.configureTestingModule({
// declarations: [ThemeColorBoxComponent],
// imports: [
// HttpClientTestingModule
// /* TranslateModule.forRoot({
// loader: {
// provide: TranslateLoader,
// useFactory: HttpLoaderFactory,
// deps: [HttpClient]
// }
// }) */
// ],
// schemas: [NO_ERRORS_SCHEMA]
// }).compileComponents()
// }))
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ThemeColorBoxComponent],
imports: [
HttpClientTestingModule
/* TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
}) */
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents()
}))

// beforeEach(() => {
// fixture = TestBed.createComponent(ThemeColorBoxComponent)
// component = fixture.componentInstance
// fixture.detectChanges()
// })
beforeEach(() => {
fixture = TestBed.createComponent(ThemeColorBoxComponent)
component = fixture.componentInstance
fixture.detectChanges()
})

// it('should create', () => {
// expect(component).toBeTruthy()
// })
// })
it('should create', () => {
expect(component).toBeTruthy()
})
})
3 changes: 2 additions & 1 deletion src/app/shared/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// import { MicrofrontendDTO } from '@onecx/portal-integration-angular'
import { AbstractControl, FormArray, FormGroup } from '@angular/forms'
import { SelectItem } from 'primeng/api'
import { Workspace /* , ThemeDTO */ } from './generated'

import { Workspace /* , ThemeDTO */ } from 'src/app/shared/generated'

export function limitText(text: string, limit: number): string {
if (text) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,43 @@
/* import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'
import { WorkspaceCreateComponent } from './workspace-create.component'
import { TranslateModule, TranslateLoader } from '@ngx-translate/core'
import { HttpClient } from '@angular/common/http'
import { HttpClientTestingModule } from '@angular/common/http/testing'
import { ReactiveFormsModule } from '@angular/forms'
import { RouterTestingModule } from '@angular/router/testing'
import { NO_ERRORS_SCHEMA } from '@angular/core'
import { PortalFormComponent } from '../portal-form/portal-form.component'
import { By } from '@angular/platform-browser'
// import { By } from '@angular/platform-browser'
import { ConfirmationService, MessageService } from 'primeng/api'
import { DropdownModule } from 'primeng/dropdown'
import { environment } from '../../../environments/environment'
import { APP_CONFIG, AUTH_SERVICE } from '@onecx/portal-integration-angular'
import { PortalInternalAPIService } from '../../generated'

import { environment } from 'src/environments/environment'
import { APP_CONFIG, AppStateService, createTranslateLoader } from '@onecx/portal-integration-angular'
// import { PortalInternalAPIService } from 'src/app/generated'

describe('WorkspaceCreateComponent', () => {
let component: WorkspaceCreateComponent
let fixture: ComponentFixture<WorkspaceCreateComponent>

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [WorkspaceCreateComponent, PortalFormComponent],
declarations: [WorkspaceCreateComponent],
imports: [
HttpClientTestingModule,
RouterTestingModule,
ReactiveFormsModule,
DropdownModule,
TranslateModule.forRoot({
isolate: true,
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory2,
deps: [HttpClient]
useFactory: createTranslateLoader,
deps: [HttpClient, AppStateService]
}
})
],
providers: [
{ provide: APP_CONFIG, useValue: environment },
{ provide: AUTH_SERVICE, useClass: IAuthMockService },
PortalInternalAPIService,
// PortalInternalAPIService,
MessageService,
ConfirmationService
],
Expand All @@ -56,19 +55,18 @@ describe('WorkspaceCreateComponent', () => {
expect(component).toBeTruthy()
})

it('should start with values', () => {
expect(component.isIdEmpty).toBe(false, 'off at first')
expect(component.isLoading).toBe(true, 'on at first')
})
// it('should start with values', () => {
// expect(component.isIdEmpty).toBe(false, 'off at first')
// expect(component.isLoading).toBe(true, 'on at first')
// })

it('should display portal page', () => {
const item = fixture.debugElement.query(By.directive(PortalPageComponent))
expect(item).toBeDefined()
})
// it('should display portal page', () => {
// const item = fixture.debugElement.query(By.directive(PortalPageComponent))
// expect(item).toBeDefined()
// })

it('should display portal mgmt form', () => {
const items = fixture.debugElement.queryAll(By.directive(PortalFormComponent))
expect(items[0]).toBeDefined()
})
// it('should display portal mgmt form', () => {
// const items = fixture.debugElement.queryAll(By.directive(PortalFormComponent))
// expect(items[0]).toBeDefined()
// })
})
*/
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { FileUpload } from 'primeng/fileupload'

import { PortalMessageService, UserService } from '@onecx/portal-integration-angular'

import { LogoState } from './logo-state'
import { LogoState } from 'src/app/workspace/workspace-create/logo-state'
// import { setFetchUrls , sortThemeByName } from '../../shared/utils'
import {
/* ImageV1APIService, */
Expand Down
Loading

0 comments on commit 81e7b06

Please sign in to comment.