Skip to content

Commit

Permalink
Code and test improvements (#63)
Browse files Browse the repository at this point in the history
* fix: code and test improvements

* fix: code improvements in app search

* fix: improvements

* fix: improvements

* fix: update bff api
  • Loading branch information
HenryT-CG authored Mar 1, 2024
1 parent ed1430c commit 4a85b99
Show file tree
Hide file tree
Showing 18 changed files with 9,613 additions and 4,326 deletions.
13,271 changes: 9,229 additions & 4,042 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
"@ngx-translate/core": "^14.0.0",
"@ngx-translate/http-loader": "^7.0.0",
"@onecx/accelerator": "^4.5.1",
"@onecx/integration-interface": "^4.5.1",
"@onecx/keycloak-auth": "^4.5.1",
"@onecx/portal-integration-angular": "^4.5.1",
"@onecx/portal-layout-styles": "^4.5.1",
"@onecx/integration-interface": "^4.9.0",
"@onecx/keycloak-auth": "^4.9.0",
"@onecx/portal-integration-angular": "^4.9.0",
"@onecx/portal-layout-styles": "^4.9.0",
"file-saver": "^2.0.5",
"i18n-iso-countries": "^7.10.0",
"ngx-color": "^8.0.3",
Expand Down Expand Up @@ -85,7 +85,7 @@
"@schematics/angular": "15.2.6",
"@storybook/addon-essentials": "7.0.4",
"@storybook/angular": "7.0.4",
"@storybook/core-server": "7.0.4 ",
"@storybook/core-server": "7.6.17",
"@svgr/webpack": "^7.0.0",
"@swc-node/register": "^1.8.0",
"@swc/cli": "~0.1.63",
Expand Down Expand Up @@ -128,7 +128,7 @@
"prettier": "^2.8.8",
"sonarqube-scanner": "^3.3.0",
"style-loader": "^3.3.2",
"stylus": "^0.59.0",
"stylus": "^0.62.0",
"stylus-loader": "^7.1.0",
"tailwindcss": "3.3.2",
"ts-node": "10.9.1",
Expand Down
41 changes: 17 additions & 24 deletions src/app/product-store/app-delete/app-delete.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { TranslateTestingModule } from 'ngx-translate-testing'
import { of, throwError } from 'rxjs'

import { PortalMessageService } from '@onecx/portal-integration-angular'
import { MicrofrontendsAPIService } from 'src/app/shared/generated'
import { MicrofrontendsAPIService, MicroservicesAPIService } from 'src/app/shared/generated'
import { AppAbstract } from '../app-search/app-search.component'
import { AppDeleteComponent } from './app-delete.component'

Expand All @@ -17,12 +17,20 @@ describe('AppDeleteComponent', () => {
appId: 'appId',
appType: 'MFE',
appName: 'name',
remoteBaseUrl: 'url',
productName: 'productName'
}
const appMs: AppAbstract = {
id: 'id',
appId: 'appId',
appType: 'MS',
appName: 'name',
productName: 'productName'
}
const msgServiceSpy = jasmine.createSpyObj<PortalMessageService>('PortalMessageService', ['success', 'error'])
const apiMfeServiceSpy = {
deleteMicrofrontend: jasmine.createSpy('deleteMicrofrontend').and.returnValue(of({})),
deleteMicrofrontend: jasmine.createSpy('deleteMicrofrontend').and.returnValue(of({}))
}
const apiMsServiceSpy = {
deleteMicroservice: jasmine.createSpy('deleteMicroservice').and.returnValue(of({}))
}

Expand All @@ -38,6 +46,7 @@ describe('AppDeleteComponent', () => {
],
providers: [
{ provide: MicrofrontendsAPIService, useValue: apiMfeServiceSpy },
{ provide: MicroservicesAPIService, useValue: apiMsServiceSpy },
{ provide: PortalMessageService, useValue: msgServiceSpy }
],
schemas: [NO_ERRORS_SCHEMA]
Expand All @@ -53,7 +62,7 @@ describe('AppDeleteComponent', () => {
msgServiceSpy.success.calls.reset()
msgServiceSpy.error.calls.reset()
apiMfeServiceSpy.deleteMicrofrontend.calls.reset()
apiMfeServiceSpy.deleteMicroservice.calls.reset()
apiMsServiceSpy.deleteMicroservice.calls.reset()
})

it('should create', () => {
Expand Down Expand Up @@ -87,33 +96,17 @@ describe('AppDeleteComponent', () => {
expect(msgServiceSpy.error).toHaveBeenCalledWith({ summaryKey: 'ACTIONS.DELETE.APP.NOK' })
})

xit('should delete ms onConfirmDeletion', () => {
apiMfeServiceSpy.deleteMicroservice.and.returnValue(of({}))
const appMs: AppAbstract = {
id: 'id',
appId: 'appId',
appType: 'MS',
appName: 'name',
remoteBaseUrl: 'url',
productName: 'productName'
}
it('should delete ms onConfirmDeletion', () => {
apiMsServiceSpy.deleteMicroservice.and.returnValue(of({}))
component.appAbstract = appMs

component.onConfirmDeletion()

expect(msgServiceSpy.success).toHaveBeenCalledWith({ summaryKey: 'ACTIONS.DELETE.APP.OK' })
})

xit('should display error if api call fails onConfirmDeletion: ms', () => {
apiMfeServiceSpy.deleteMicroservice.and.returnValue(throwError(() => new Error()))
const appMs: AppAbstract = {
id: 'id',
appId: 'appId',
appType: 'MS',
appName: 'name',
remoteBaseUrl: 'url',
productName: 'productName'
}
it('should display error if api call fails onConfirmDeletion: ms', () => {
apiMsServiceSpy.deleteMicroservice.and.returnValue(throwError(() => new Error()))
component.appAbstract = appMs

component.onConfirmDeletion()
Expand Down
1 change: 0 additions & 1 deletion src/app/product-store/app-detail/app-detail.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core'
//import { DatePipe } from '@angular/common'
import { FormControl, FormGroup, Validators } from '@angular/forms'
import { finalize } from 'rxjs'
import { TranslateService } from '@ngx-translate/core'
Expand Down
2 changes: 1 addition & 1 deletion src/app/product-store/app-search/app-search.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
<span
*ngIf="app.appType === 'MFE'"
[id]="'app_search_data_icon'"
class="card-badge-right badge-2 p-2 pi"
class="card-badge-right badge-2 p-2 pi cursor-auto"
[ngClass]="'pi-' + app.iconName"
title="Icon"
></span>
Expand Down
Loading

0 comments on commit 4a85b99

Please sign in to comment.