diff options
author | Yoav Schneiderman <yoav.schneiderman@intl.att.com> | 2020-01-02 14:37:13 +0200 |
---|---|---|
committer | Yoav Schneiderman <yoav.schneiderman@intl.att.com> | 2020-01-02 15:29:03 +0200 |
commit | b51ac2ce386fa1d5f9806dae6e177b18e293c61f (patch) | |
tree | 04890ec8096b39fc15e966823ef24b983cfcbbc4 /vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.spec.ts | |
parent | 9364e31c8bc851b7543b0c16846dc6ef3ccf41c3 (diff) |
Template modal - Start from Scratch button + UT
Issue-ID: VID-739
Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com>
Change-Id: Ie390a53714212d4d943789d14bb2fb51f7311277
Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.spec.ts')
-rw-r--r-- | vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.spec.ts | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.spec.ts index a17abedfc..308597ac6 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.spec.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.spec.ts @@ -2,7 +2,7 @@ import {getTestBed, TestBed} from '@angular/core/testing'; import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing'; import {InstantiationTemplatesModalService} from "./instantiation.templates.modal.service"; import {AaiService} from "../../../services/aaiService/aai.service"; -import {ActivatedRoute} from "@angular/router"; +import {ActivatedRoute, Router} from "@angular/router"; import {IframeService} from "../../../utils/iframe.service"; import {NgRedux} from "@angular-redux/store"; import {FeatureFlagsService} from "../../../services/featureFlag/feature-flags.service"; @@ -17,16 +17,25 @@ class ActivatedRouteMock<T> { } } -class MockAppStore { +// -} + +class MockAppStore {} describe('instantiation templates modal service', () => { + const serviceModelId :string = 'serviceModelId'; let injector; let service: InstantiationTemplatesModalService; let httpMock: HttpTestingController; let _aaiService: AaiService; let _activatedRoute: ActivatedRoute; + let _router : Router; + + + + let router = { + navigate: jasmine.createSpy('navigate') + }; beforeAll(done => (async () => { TestBed.configureTestingModule({ @@ -35,6 +44,7 @@ describe('instantiation templates modal service', () => { IframeService, AaiService, FeatureFlagsService, + { provide: Router, useValue: router }, {provide: ActivatedRoute, useClass: ActivatedRouteMock}, {provide: NgRedux, useClass: MockAppStore} ] @@ -46,6 +56,7 @@ describe('instantiation templates modal service', () => { httpMock = injector.get(HttpTestingController); _aaiService = injector.get(AaiService); _activatedRoute = injector.get(ActivatedRoute); + _router = injector.get(Router); })().then(done).catch(done.fail)); @@ -157,4 +168,12 @@ describe('instantiation templates modal service', () => { expect(result).toHaveLength(0); }); + + test('navigateToNewServiceModal should navigate to new service modal', ()=>{ + + service.navigateToNewServiceModal(serviceModelId); + + expect(_router.navigate).toBeCalledWith(["/servicePopup"], {"queryParams": {"isCreate": true, "serviceModelId": serviceModelId}, "queryParamsHandling": "merge"}); + }) + }); |