blob: 72ded4628b14897913102c51e9af5f75000dc119 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {FormsModule} from '@angular/forms';
import { EditDrillDownLinkComponent } from './edit-drill-down-link.component';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ColumnService } from '../../column.service';
import 'rxjs/add/observable/of';
import { Observable } from 'rxjs/Observable';
describe('EditDrillDownLinkComponent', () => {
let component: EditDrillDownLinkComponent;
let fixture: ComponentFixture<EditDrillDownLinkComponent>;
let _columnService:ColumnService;
const drilldownobj1 = {"drillDownUrl":"dummyURL"}
let stubData1=[{
"baseUrl":"baseUrl"
}];
let stubData2=[{
"baseUrl":123
}]
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditDrillDownLinkComponent],
imports: [FormsModule, HttpClientTestingModule],
providers: [ColumnService]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EditDrillDownLinkComponent);
component = fixture.componentInstance;
component.drillDownObj = drilldownobj1;
fixture.detectChanges();
_columnService=TestBed.get(ColumnService);
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('getDrillDownReportColumnDetails should return stubbed value',()=>{
let spy1=spyOn(_columnService,'getDrillDownReportColumnDetails').and.returnValue(Observable.of('your value'))
component.ngOnInit();
expect(spy1).toHaveBeenCalled();
})
it('should test getValueOfColumnDetails',()=>{
let spy2=spyOn(_columnService,'getValueOfColumnDetails').and.returnValue(Observable.of('your value'))
component.ngOnInit();
// expect(spy2).toHaveBeenCalled();
})
it('should test ngDoCheck method',()=>{
component.ngDoCheck();
})
});
|