aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/vnfs
diff options
context:
space:
mode:
authorArundathi Patil <arundpil@in.ibm.com>2018-07-30 15:45:23 +0530
committerTakamune Cho <tc012c@att.com>2018-08-01 18:03:12 +0000
commitb2a71e7b2b929f25379dc2fb51d2c3abdbf0f346 (patch)
treef771e9d59ec1b78931124624f8bae0ce7bf0bd51 /src/app/vnfs
parentbded4b104540b8252c4b424ba475aab4820542a7 (diff)
Fixed error in user-login-form spec file
Test cases in userLogin-form spec file failed with below error, Error: Cannot read property 'root' of undefined. This error was because, activated route was not injected into the testingbed. Fixed this error. Issue-ID: APPC-1064 Change-Id: Ib9978b73be744204e8dd64b97abbc0959a4e5839 Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
Diffstat (limited to 'src/app/vnfs')
-rw-r--r--src/app/vnfs/userlogin-form/userlogin-form.component.spec.ts19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/app/vnfs/userlogin-form/userlogin-form.component.spec.ts b/src/app/vnfs/userlogin-form/userlogin-form.component.spec.ts
index d253cb7..16863a4 100644
--- a/src/app/vnfs/userlogin-form/userlogin-form.component.spec.ts
+++ b/src/app/vnfs/userlogin-form/userlogin-form.component.spec.ts
@@ -2,6 +2,8 @@
============LICENSE_START==========================================
===================================================================
Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+
+Modification Copyright (C) 2018 IBM
===================================================================
Unless otherwise specified, all software contained herein is licensed
@@ -24,6 +26,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';
+import { ActivatedRoute } from '@angular/router';
import { userloginFormComponent } from './userlogin-form.component';
import { FormsModule } from '@angular/forms';
import { NotificationService } from './../../shared/services/notification.service';
@@ -39,15 +42,21 @@ import {NotificationsService} from 'angular2-notifications';
describe('userloginFormComponent', () => {
let component: userloginFormComponent;
let fixture: ComponentFixture<userloginFormComponent>;
+ let mockActiveRoute = {
+ snapshot: {
+ queryParams: {
+ returnUrl: '/home',
+ }
+ }
+ };
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [userloginFormComponent],
schemas: [NO_ERRORS_SCHEMA],
imports: [FormsModule, RouterTestingModule,],
- providers: [UtilityService, ParamShareService, DialogService, NotificationService,NotificationsService, HttpUtilService, MappingEditorService, {
- provide: Router,
- useClass: MockRouter
- }, { provide: Router, useClass: MockRouter }]
+ providers: [UtilityService, ParamShareService, DialogService,NotificationsService, HttpUtilService, MappingEditorService,
+ {provide: ActivatedRoute, useValue: mockActiveRoute},
+ { provide: Router, useClass: MockRouter }]
})
.compileComponents();
}));
@@ -82,7 +91,7 @@ describe('userloginFormComponent', () => {
});
it('should route to myvnfform', inject([Router], (router: Router) => {
- const spy = spyOn(router, 'navigate');
+ const spy = spyOn(router, 'navigateByUrl');
component.getData();
const url = spy.calls.first().args[0];