11import { TestBed } from '@angular/core/testing' ;
2- import { RouterTestingModule } from '@angular/router/testing' ;
3- import { Router , Routes } from '@angular/router' ;
2+ import { Router , RouterModule , Routes } from '@angular/router' ;
43
54import { SidebarNavHelper } from './sidebar-nav.service' ;
65
76describe ( 'SidebarNavHelper' , ( ) => {
87 let service : SidebarNavHelper ;
9- let router : RouterTestingModule ;
8+ let router : RouterModule ;
109 const routes : Routes = [
1110 { path : 'dashboard' , redirectTo : 'home' , pathMatch : 'full' } ,
1211 { path : '' , redirectTo : 'dashboard' , pathMatch : 'full' }
1312 ] ;
1413
1514 beforeEach ( ( ) => {
1615 TestBed . configureTestingModule ( {
17- imports : [ RouterTestingModule . withRoutes ( routes ) ] ,
16+ imports : [ RouterModule . forRoot ( routes ) ] ,
1817 providers : [ SidebarNavHelper ]
1918 } ) ;
2019
@@ -28,21 +27,26 @@ describe('SidebarNavHelper', () => {
2827 it ( 'should return itemType' , ( ) => {
2928 expect ( service . itemType ( { divider : true } ) ) . toEqual ( 'divider' ) ;
3029 expect ( service . itemType ( { title : true } ) ) . toEqual ( 'title' ) ;
31- expect ( service . itemType ( {
32- children : [ {
33- name : 'Dropdown' ,
34- url : '/dashboard'
35- } ]
36- } ) ) . toEqual ( 'group' ) ;
30+ expect (
31+ service . itemType ( {
32+ children : [
33+ {
34+ name : 'Dropdown' ,
35+ url : '/dashboard'
36+ }
37+ ]
38+ } )
39+ ) . toEqual ( 'group' ) ;
3740 expect ( service . itemType ( { label : { variant : 'info' } } ) ) . toEqual ( 'label' ) ;
3841 expect ( service . itemType ( { } ) ) . toEqual ( 'empty' ) ;
39- expect ( service . itemType ( {
42+ expect (
43+ service . itemType ( {
4044 name : 'Disabled' ,
4145 url : '/dashboard' ,
4246 icon : 'icon-ban' ,
4347 attributes : { disabled : true }
44- }
45- ) ) . toEqual ( 'link' ) ;
48+ } )
49+ ) . toEqual ( 'link' ) ;
4650 } ) ;
4751
4852 it ( 'should be active' , ( ) => {
@@ -60,10 +64,12 @@ describe('SidebarNavHelper', () => {
6064 } ) ;
6165
6266 it ( 'should return icon class object' , ( ) => {
63- expect ( service . getIconClass ( { icon : 'icon-ban' } ) ) . toEqual ( jasmine . objectContaining ( {
64- 'nav-icon' : true ,
65- 'icon-ban' : true
66- } ) ) ;
67+ expect ( service . getIconClass ( { icon : 'icon-ban' } ) ) . toEqual (
68+ jasmine . objectContaining ( {
69+ 'nav-icon' : true ,
70+ 'icon-ban' : true
71+ } )
72+ ) ;
6773 expect ( service . getIconClass ( { icon : 'icon-ban' } ) ) . toEqual ( jasmine . objectContaining ( { 'nav-icon' : true } ) ) ;
6874 expect ( service . getIconClass ( { icon : '' } ) ) . toEqual ( jasmine . objectContaining ( { 'nav-icon' : true } ) ) ;
6975 } ) ;
0 commit comments