From 095fb8c5c7ef690bc6f4317338f0716a8b7c6cb9 Mon Sep 17 00:00:00 2001 From: Lathish Date: Thu, 28 Jan 2021 17:14:19 +0000 Subject: [PATCH] Enable Test to run in Debug mode Issue-ID: NONRTRIC-417 Change-Id: Ifc0c9e40557d6216381084ff479974448f1540fb Signed-off-by: Lathish --- .gitignore | 1 - webapp-frontend/.gitignore | 2 +- webapp-frontend/.vscode/launch.json | 28 ++++++++++++++++++++++ webapp-frontend/package.json | 2 +- webapp-frontend/src/app/app.component.spec.ts | 12 +++------- .../src/app/services/policy/policy.service.spec.ts | 1 - .../src/app/ui/ei-card/ei-card.component.spec.ts | 7 ++---- .../ui/policy-card/policy-card.component.spec.ts | 7 ++---- 8 files changed, 37 insertions(+), 23 deletions(-) create mode 100644 webapp-frontend/.vscode/launch.json diff --git a/.gitignore b/.gitignore index 55ac7f1..dd8f270 100644 --- a/.gitignore +++ b/.gitignore @@ -47,7 +47,6 @@ target ### visual studio ### .vs -**/.vscode # OSx cruft **/.DS_Store diff --git a/webapp-frontend/.gitignore b/webapp-frontend/.gitignore index 519a044..137f7d7 100644 --- a/webapp-frontend/.gitignore +++ b/webapp-frontend/.gitignore @@ -15,7 +15,7 @@ /.settings /target/ /.mvn/wrapper/maven-wrapper.jar -**/.vscode + ### STS ### .apt_generated diff --git a/webapp-frontend/.vscode/launch.json b/webapp-frontend/.vscode/launch.json new file mode 100644 index 0000000..a67e931 --- /dev/null +++ b/webapp-frontend/.vscode/launch.json @@ -0,0 +1,28 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:9876", + "webRoot": "${workspaceFolder}" + }, + { + "type": "chrome", + "request": "launch", + "name": "Jasmine Debugger", + "url": "http://localhost:9876/debug.html", + "webRoot": "${workspaceFolder}", + "sourceMaps": true, + "sourceMapPathOverrides": { + "webpack:/*": "${webRoot}/*", + "/./*": "${webRoot}/*", + "/src/*": "${webRoot}/*", + "./*": "${webRoot}/*", + "_karma_webpack_/*": "${webRoot}/*", + "/./~/*": "${workspaceFolder}/node_modules/*" + } + } + ] +} \ No newline at end of file diff --git a/webapp-frontend/package.json b/webapp-frontend/package.json index ee07def..e4a5600 100644 --- a/webapp-frontend/package.json +++ b/webapp-frontend/package.json @@ -6,7 +6,7 @@ "start": "ng serve --proxy-config proxy.conf.json", "start:mock": "ng serve --configuration=mock", "build": "ng build", - "test": "ng test", + "test": "ng test --watch=true", "lint": "ng lint", "e2e": "ng e2e" }, diff --git a/webapp-frontend/src/app/app.component.spec.ts b/webapp-frontend/src/app/app.component.spec.ts index 7222b1e..3e707be 100644 --- a/webapp-frontend/src/app/app.component.spec.ts +++ b/webapp-frontend/src/app/app.component.spec.ts @@ -1,23 +1,17 @@ import { TestBed, async } from '@angular/core/testing'; -import { APP_BASE_HREF } from '@angular/common'; -import { RouterModule, Routes } from '@angular/router'; +import { RouterTestingModule } from '@angular/router/testing'; import { AppComponent } from './app.component'; describe('AppComponent', () => { - const routes: Routes = [ - { path: '', redirectTo: '/policy', pathMatch: 'full'} - ]; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ AppComponent ], imports: [ - RouterModule.forRoot(routes) + RouterTestingModule ], - providers: [ - { provide: APP_BASE_HREF, useValue: '/' } - ] + providers: [] }).compileComponents(); })); diff --git a/webapp-frontend/src/app/services/policy/policy.service.spec.ts b/webapp-frontend/src/app/services/policy/policy.service.spec.ts index 3e366da..b451823 100644 --- a/webapp-frontend/src/app/services/policy/policy.service.spec.ts +++ b/webapp-frontend/src/app/services/policy/policy.service.spec.ts @@ -59,7 +59,6 @@ describe('PolicyService', () => { policytypes => expect(policytypes).toEqual(expectedPolicytypes, 'should return expected PolicyTypes'), fail ); - const req = httpTestingController.expectOne(basePath + apiVersion2 + '/' + policyService.policyTypesPath); expect(req.request.method).toEqual('GET'); diff --git a/webapp-frontend/src/app/ui/ei-card/ei-card.component.spec.ts b/webapp-frontend/src/app/ui/ei-card/ei-card.component.spec.ts index 7bdf97c..4b85328 100644 --- a/webapp-frontend/src/app/ui/ei-card/ei-card.component.spec.ts +++ b/webapp-frontend/src/app/ui/ei-card/ei-card.component.spec.ts @@ -21,13 +21,10 @@ import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import {EICardComponent} from './ei-card.component'; import { MatIconModule } from '@angular/material'; -import { RouterModule, Routes } from '@angular/router'; +import { RouterTestingModule } from '@angular/router/testing'; import {UiService} from '../../services/ui/ui.service'; describe('EICardComponent', () => { - const routes: Routes = [ - { path: 'ei-coordinator', redirectTo: '../../ei-coordinator', pathMatch: 'full'} - ]; let component: EICardComponent; let fixture: ComponentFixture; @@ -35,7 +32,7 @@ describe('EICardComponent', () => { TestBed.configureTestingModule({ declarations: [EICardComponent], imports: [ MatIconModule, - RouterModule.forRoot(routes) + RouterTestingModule ], providers: [UiService] }) diff --git a/webapp-frontend/src/app/ui/policy-card/policy-card.component.spec.ts b/webapp-frontend/src/app/ui/policy-card/policy-card.component.spec.ts index 4dd9000..1031db9 100644 --- a/webapp-frontend/src/app/ui/policy-card/policy-card.component.spec.ts +++ b/webapp-frontend/src/app/ui/policy-card/policy-card.component.spec.ts @@ -21,13 +21,10 @@ import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import {PolicyCardComponent} from './policy-card.component'; import { MatIconModule,MatCardModule } from '@angular/material'; -import { RouterModule, Routes } from '@angular/router'; +import { RouterTestingModule} from '@angular/router/testing'; import {UiService} from '../../services/ui/ui.service'; describe('PolicyCardComponent', () => { - const routes: Routes = [ - { path: 'policy', redirectTo: '../../policy', pathMatch: 'full'} - ]; let component: PolicyCardComponent; let fixture: ComponentFixture; @@ -35,7 +32,7 @@ describe('PolicyCardComponent', () => { TestBed.configureTestingModule({ declarations: [PolicyCardComponent], imports: [ MatIconModule,MatCardModule, - RouterModule.forRoot(routes) + RouterTestingModule ], providers: [UiService] }) -- 2.16.6