diff options
author | 2022-11-24 10:29:04 +0000 | |
---|---|---|
committer | 2023-01-26 23:32:10 +0000 | |
commit | 701e441228724c5b701d94cc3f1e520ce656398a (patch) | |
tree | 5900482086d86f8b8e465e6d4b57db4bd7a94184 /catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-general/type-workspace-general.component.spec.ts | |
parent | 1bbecd7edbdd907a53812d303d378236d23d071e (diff) |
Import data type in UI
Develop all necessary changes in the UI to allow importing a data type from a yaml file
Issue-ID: SDC-4279
Signed-off-by: franciscovila <javier.paradela.vila@est.tech>
Change-Id: Id413386fad8b362e8c4a1d25c859a22178189074
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-general/type-workspace-general.component.spec.ts')
-rw-r--r-- | catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-general/type-workspace-general.component.spec.ts | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-general/type-workspace-general.component.spec.ts b/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-general/type-workspace-general.component.spec.ts index fe7b070354..1484954e4b 100644 --- a/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-general/type-workspace-general.component.spec.ts +++ b/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-general/type-workspace-general.component.spec.ts @@ -25,22 +25,53 @@ import {TypeWorkspaceGeneralComponent} from './type-workspace-general.component' import {ReactiveFormsModule} from "@angular/forms"; import {TranslateModule} from "../../../shared/translator/translate.module"; import {TranslateService} from "../../../shared/translator/translate.service"; +import {SdcUiComponentsModule} from "onap-ui-angular/dist"; +import {Observable} from "rxjs/Observable"; +import {DataTypeModel} from "../../../../models/data-types"; +import {DataTypeService} from "../../../services/data-type.service"; +import {ModelService} from "../../../services/model.service"; +import {IWorkspaceViewModelScope} from "../../../../view-models/workspace/workspace-view-model"; +import {IScope} from "angular"; +import {States} from "../../../../utils/constants"; describe('TypeWorkspaceGeneralComponent', () => { let component: TypeWorkspaceGeneralComponent; let fixture: ComponentFixture<TypeWorkspaceGeneralComponent>; + let dataTypeServiceMock: Partial<DataTypeService>; + let modelServiceMock: Partial<ModelService>; let translateServiceMock: Partial<TranslateService> = { 'translate': jest.fn() }; + let importedFileMock: File = null; + let stateParamsMock: Partial<ng.ui.IStateParamsService> = { + 'importedFile': importedFileMock + }; + let resolveMock = {"$stateParams": stateParamsMock}; + let parentScopeMock: Partial<IScope> = { + '$resolve': resolveMock + }; + let scopeMock_: Partial<IWorkspaceViewModelScope> = { + '$parent': parentScopeMock, + 'current': { + 'name': States.TYPE_WORKSPACE + } + } + beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ TypeWorkspaceGeneralComponent ], imports: [ ReactiveFormsModule, + SdcUiComponentsModule, TranslateModule ], providers: [ + {provide: TranslateService, useValue: translateServiceMock}, + {provide: "$scope", useValue: scopeMock_ }, + {provide: "$state", useValue: {}}, + {provide: DataTypeService, useValue: dataTypeServiceMock}, + {provide: ModelService, useValue: modelServiceMock}, {provide: TranslateService, useValue: translateServiceMock} ] }) @@ -50,6 +81,7 @@ describe('TypeWorkspaceGeneralComponent', () => { beforeEach(() => { fixture = TestBed.createComponent(TypeWorkspaceGeneralComponent); component = fixture.componentInstance; + component.dataTypeMap$ = new Observable<Map<string, DataTypeModel>>(); fixture.detectChanges(); }); |