summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages/composition/panel/panel-tabs/info-tab/info-tab.component.spec.ts
diff options
context:
space:
mode:
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.ts27
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";