11import { ComponentFixture , TestBed } from '@angular/core/testing' ;
22
33import { UsageComponent } from './usage.component' ;
4+ import { ActivatedRoute } from '@angular/router' ;
5+ import { of } from 'rxjs' ;
46
57describe ( 'UsageComponent' , ( ) => {
68 let component : UsageComponent ;
@@ -12,13 +14,28 @@ describe('UsageComponent', () => {
1214 } ) . compileComponents ( ) ;
1315 } ) ;
1416
15- beforeEach ( ( ) => {
17+ it ( 'should create' , ( ) => {
18+ TestBed . overrideProvider ( ActivatedRoute , {
19+ useValue : { params : of ( { } ) } ,
20+ } ) ;
21+
1622 fixture = TestBed . createComponent ( UsageComponent ) ;
1723 component = fixture . componentInstance ;
1824 fixture . detectChanges ( ) ;
19- } ) ;
2025
21- it ( 'should create' , ( ) => {
2226 expect ( component ) . toBeTruthy ( ) ;
27+ expect ( component . page ) . toBe ( 'USAGE' ) ;
28+ } ) ;
29+
30+ it ( 'should load page' , ( ) => {
31+ TestBed . overrideProvider ( ActivatedRoute , {
32+ useValue : { params : of ( { page : 'test-page' } ) } ,
33+ } ) ;
34+
35+ fixture = TestBed . createComponent ( UsageComponent ) ;
36+ component = fixture . componentInstance ;
37+ fixture . detectChanges ( ) ;
38+
39+ expect ( component . page ) . toBe ( 'test-page' ) ;
2340 } ) ;
2441} ) ;
0 commit comments