Skip to content

Commit

Permalink
fix: unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
udayvunnam committed Jul 20, 2020
1 parent c0f9e1b commit f6350a4
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 7 deletions.
37 changes: 37 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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": [
"<node_internals>/**"
],
"type": "pwa-node"
},
{
"name": "Attach",
"port": 9229,
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"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"
}
]
}
10 changes: 7 additions & 3 deletions libs/xng-breadcrumb/src/lib/breadcrumb.component.spec.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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();
}));

Expand Down
12 changes: 8 additions & 4 deletions libs/xng-breadcrumb/src/lib/breadcrumb.service.spec.ts
Original file line number Diff line number Diff line change
@@ -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();
});
});

0 comments on commit f6350a4

Please sign in to comment.