diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5c9eea5 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,37 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Attach by Process ID", + "processId": "${command:PickProcess}", + "request": "attach", + "skipFiles": [ + "/**" + ], + "type": "pwa-node" + }, + { + "name": "Attach", + "port": 9229, + "request": "attach", + "skipFiles": [ + "/**" + ], + "type": "pwa-node" + }, + { + "type": "node", + "name": "vscode-jest-tests", + "request": "launch", + "args": ["--runInBand"], + "cwd": "${fileDirname}", + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "disableOptimisticBPs": true, + "program": "${workspaceFolder}/node_modules/jest/bin/jest" + } + ] +} diff --git a/libs/xng-breadcrumb/src/lib/breadcrumb.component.spec.ts b/libs/xng-breadcrumb/src/lib/breadcrumb.component.spec.ts index 2f54f1e..7d3a250 100644 --- a/libs/xng-breadcrumb/src/lib/breadcrumb.component.spec.ts +++ b/libs/xng-breadcrumb/src/lib/breadcrumb.component.spec.ts @@ -1,8 +1,9 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import 'zone.js/dist/zone-testing' +import { APP_BASE_HREF,CommonModule } from '@angular/common'; +import { RouterModule } from '@angular/router'; import { BreadcrumbComponent } from './breadcrumb.component'; -import { CommonModule } from '@angular/common'; -import { RouterModule } from '@angular/router'; describe('BreadcrumbComponent', () => { let component: BreadcrumbComponent; @@ -11,7 +12,10 @@ describe('BreadcrumbComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [BreadcrumbComponent], - imports: [CommonModule, RouterModule.forRoot([])] + imports: [CommonModule, RouterModule.forRoot([])], + providers: [ + { provide: APP_BASE_HREF, useValue : '/' } + ] }).compileComponents(); })); diff --git a/libs/xng-breadcrumb/src/lib/breadcrumb.service.spec.ts b/libs/xng-breadcrumb/src/lib/breadcrumb.service.spec.ts index 54ad1b8..4d2e74b 100644 --- a/libs/xng-breadcrumb/src/lib/breadcrumb.service.spec.ts +++ b/libs/xng-breadcrumb/src/lib/breadcrumb.service.spec.ts @@ -1,18 +1,22 @@ import { TestBed } from '@angular/core/testing'; -import { CommonModule } from '@angular/common'; +import { CommonModule,APP_BASE_HREF } from '@angular/common'; import { RouterModule } from '@angular/router'; +import 'zone.js/dist/zone-testing' import { BreadcrumbService } from './breadcrumb.service'; -describe('XngBreadcrumbService', () => { +describe('BreadcrumbService', () => { beforeEach(() => TestBed.configureTestingModule({ - imports: [CommonModule, RouterModule.forRoot([])] + imports: [CommonModule, RouterModule.forRoot([])], + providers: [ + { provide: APP_BASE_HREF, useValue: '/' } + ] }) ); it('should be created', () => { - const service: BreadcrumbService = TestBed.get(BreadcrumbService); + const service: BreadcrumbService = TestBed.inject(BreadcrumbService); expect(service).toBeTruthy(); }); });