diff options
author | KrupaNagabhushan <krupa.nagabhushan@est.tech> | 2022-05-25 16:14:21 +0100 |
---|---|---|
committer | Krupa Nagabhushan <krupa.nagabhushan@est.tech> | 2022-05-26 14:20:53 +0000 |
commit | b192e55dff318d97472130971a5ebc37ae30fe29 (patch) | |
tree | ef93717879bfe862e8430f70c58dd9c21b66532e /catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/info-tab/info-tab.component.spec.ts | |
parent | ac3098e03c5ec20dc8d85b2497750263ad1f1f00 (diff) |
Fix Component Instance versions not updating
Issue-ID: SDC-4021
Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech>
Change-Id: Iea32227714504b445689f0d934fdb7d79dd7b09d
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/info-tab/info-tab.component.spec.ts')
-rw-r--r-- | catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/info-tab/info-tab.component.spec.ts | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/info-tab/info-tab.component.spec.ts b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/info-tab/info-tab.component.spec.ts index 388e4b5542..263e22fa9f 100644 --- a/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/info-tab/info-tab.component.spec.ts +++ b/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/info-tab/info-tab.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { async, ComponentFixture} from '@angular/core/testing'; import { NO_ERRORS_SCHEMA } from '@angular/core'; import { Store } from '@ngxs/store'; import { CompositionPaletteService } from '../../../../../pages/composition/palette/services/palette.service'; @@ -13,14 +13,13 @@ import { ConfigureFn, configureTests } from "../../../../../../../jest/test-conf import { Observable } from "rxjs"; import { leftPaletteElements } from "../../../../../../../jest/mocks/left-paeltte-elements.mock"; import { TranslatePipe } from "../../../../../shared/translator/translate.pipe"; -import { HttpClientModule } from "@angular/common/http"; -import { TranslateModule } from "../../../../../../../app/ng2/shared/translator/translate.module"; -import _ from "lodash"; import { TranslateService } from "../../../../../shared/translator/translate.service"; import { SdcUiServices } from "onap-ui-angular"; -import { Component as TopologyTemplate, FullComponentInstance, ComponentInstance } from '../../../../../../../app/models'; +import {Component as TopologyTemplate, ComponentInstance, ComponentMetadata} from '../../../../../../../app/models'; import {KeyValuePipe} from "../../../../../pipes/key-value.pipe"; - +import {TopologyTemplateService} from "../../../../../services/component-services/topology-template.service"; +import {ComponentGenericResponse} from "../../../../../services/responses/component-generic-response"; +import {serviceMetadata} from "../../../../../../../jest/mocks/service-metadata.mock"; describe('InfoTabComponent', () => { @@ -31,11 +30,9 @@ describe('InfoTabComponent', () => { let storeStub:Partial<Store>; let compositionPaletteServiceStub:Partial<CompositionPaletteService>; let iAppMenuStub:Partial<IAppMenu>; - let compositionServiceStub:Partial<CompositionService>; - let serviceServiceNg2Stub:Partial<ServiceServiceNg2>; - let workspaceServiceStub:Partial<WorkspaceService>; - let componentInstanceServiceNg2Stub:Partial<ComponentInstanceServiceNg2>; let eventListenerServiceStub:Partial<EventListenerService>; + let topologyTemplateServiceStub:Partial<TopologyTemplateService>; + let componentGenericResponseStub:Partial<ComponentGenericResponse>; beforeEach( async(() => { @@ -47,6 +44,13 @@ describe('InfoTabComponent', () => { compositionPaletteServiceStub = { getLeftPaletteElements: jest.fn().mockImplementation(()=> Observable.of(leftPaletteElements)) } + componentGenericResponseStub = { + metadata: new ComponentMetadata() + } + componentGenericResponseStub.metadata.allVersions = serviceMetadata.allVersions; + topologyTemplateServiceStub = { + getComponentMetadata: jest.fn().mockImplementation(() => Observable.of(componentGenericResponseStub)) + } const configure: ConfigureFn = testBed => { testBed.configureTestingModule({ imports: [ ], @@ -62,6 +66,7 @@ describe('InfoTabComponent', () => { { provide: WorkspaceService, useValue: {} }, { provide: ComponentInstanceServiceNg2, useValue: {} }, { provide: EventListenerService, useValue: eventListenerServiceStub }, + { provide: TopologyTemplateService, useValue: topologyTemplateServiceStub}, { provide: TranslateService, useValue: {}} ] }); @@ -88,7 +93,7 @@ describe('InfoTabComponent', () => { }); it('does not contain the highest minor version if it is checked out', () => { fixture.componentInstance.component = new ComponentInstance(); - fixture.componentInstance.component.allVersions = + fixture.componentInstance.component.allVersions = {'1.0': "9c829122-af05-4bc9-b537-5d84f4c8ae25", '1.1': "930d56cb-868d-4e35-bd0f-e737d2fdb171"}; fixture.componentInstance.component.version = "1.0"; fixture.componentInstance.component.uuid = "a8cf015e-e4e5-4d4b-a01e-8624e8d36095"; |