These are chat archives for AngularClass/angular2-webpack-starter

19th
Jul 2017
texirv0203
@texirv0203
Jul 19 2017 21:26
@all can you tell me how to write test case for the below file
https://jsfiddle.net/ev5c423h/
texirv0203
@texirv0203
Jul 19 2017 21:53
  • I am new to angular 2 and I am writing test case.
  • actual functionality code I am providing in fiddle https://jsfiddle.net/ev5c423h/
  • when i add console in the test case its not showing in the terminal.
  • providing my code below
  • can you tell how to fix it
import {ComponentFixture, TestBed, async,fakeAsync,inject} from '@angular/core/testing';
import { BrowserModule } from '@angular/platform-browser';
import {By} from "@angular/platform-browser";
import {DebugElement} from "@angular/core";
import { MockBackend,  MockConnection } from '@angular/http/testing';
import { HttpModule, Http, XHRBackend, Response, ResponseOptions } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import {Component, ElementRef,OnInit,ViewChild} from '@angular/core';
import { SPORTSService } from '../../app/services/sports.service';
import {KendoGridComponent} from '../../app/components/grid/grid.component';


import {Signal} from '../../app/components/financials/finance-dashboard-title';


describe("sports titke search", () => {

  console.log("testing")

  let Component: KendoGridComponent;
  let Fixture: ComponentFixture<KendoGridComponent>;
  let textDebugElement: DebugElement;
  let textElement: HTMLElement;


  beforeEach(async(() => {

    TestBed.configureTestingModule({
          imports: [ HttpModule ],
                  declarations:[KendoGridComponent,ProgressCircle],
                  providers:[DecodeService,SPORTSService,jumpService,saveService,TranslateService,TRANSLATION_PROVIDERS,{ provide: XHRBackend, useClass: MockBackend }]
    }).compileComponents().then(() =>{
    Fixture = TestBed.createComponent(KendoGridComponent);
    Component = Fixture.componentInstance;
      });

  }));

  it("jump criteria search",()=>{
      let data= "{jumpId:0,operationType:search,jumpsDto:null,jumpsSearch:{networks:[1],title:'',titleType:,titleSubType:'',distributorName:'',jumpNumber:'',jumpStatus:'',jumpReference:'',packageName:''}}";
    //let data = "ssoId:&name:&networkNo:1&deptRole:292&status:active&accessNetwork:2&permissionLevelId:1";
    Component._dataSource = new kendo.data.DataSource
    Component.gridSearch("jumps",data,'post');

  });

});