Advertisement
Guest User

Untitled

a guest
May 24th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import {TestBed, async, ComponentFixture, fakeAsync, flush} from '@angular/core/testing';
  2. import {AppComponent} from './app.component';
  3.  
  4. describe('AppComponent', () => {
  5.  
  6.     let fixture: ComponentFixture<AppComponent>;
  7.     let component: AppComponent;
  8.  
  9.     beforeEach(async(() => {
  10.         TestBed.configureTestingModule({
  11.             declarations: [
  12.                 AppComponent
  13.             ],
  14.         }).compileComponents();
  15.  
  16.         fixture = TestBed.createComponent(AppComponent);
  17.         component = fixture.componentInstance;
  18.     }));
  19.  
  20.     it('test case', fakeAsync(() => {
  21.         console.log('called function');
  22.         component.functionUnderTest();
  23.         console.log('calling flush');
  24.  
  25.         flush();
  26.  
  27.         console.log('after flush');
  28.     }));
  29. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement