How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • import { fakeAsync, TestBed, tick } from '@angular/core/testing';
    
    import { CanvasComponent } from './canvas.component';
    
    describe('CanvasComponent', () => {
      beforeEach(async () => {
        await TestBed
            .configureTestingModule({
              declarations: [CanvasComponent],
            })
            .compileComponents();
      });
    
      it('should be able to generate blob data from canvas', fakeAsync(() => {
           const fixture = TestBed.createComponent(CanvasComponent);
           const canvasComp = fixture.componentInstance;
    
           fixture.detectChanges();
           expect(canvasComp.blobSize).toBe(0);
    
           tick();
           expect(canvasComp.blobSize).toBeGreaterThan(0);
         }));
    });
    Docs
  • import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
    
    import { BannerComponent } from './banner.component';
    
    describe('BannerComponent', () => {
      let component: BannerComponent;
      let fixture: ComponentFixture<BannerComponent>;
    
      beforeEach(waitForAsync(() => {
        TestBed.configureTestingModule({declarations: [BannerComponent]}).compileComponents();
      }));
    
      beforeEach(() => {
        fixture = TestBed.createComponent(BannerComponent);
        component = fixture.componentInstance;
        fixture.detectChanges();
      });
    
      it('should create', () => {
        expect(component).toBeDefined();
      });
    });
    Docs
  • TestBed
        .configureTestingModule({declarations: [DashboardHeroComponent, TestHostComponent]})
    // create TestHostComponent instead of DashboardHeroComponent
    fixture = TestBed.createComponent(TestHostComponent);
    testHost = fixture.componentInstance;
    heroEl = fixture.nativeElement.querySelector('.hero');
    fixture.detectChanges();  // trigger initial data binding
    Docs
  • TestBed
        .configureTestingModule({declarations: [DashboardHeroComponent]})
    fixture = TestBed.createComponent(DashboardHeroComponent);
    comp = fixture.componentInstance;
    
    // find the hero's DebugElement and element
    heroDe = fixture.debugElement.query(By.css('.hero'));
    heroEl = heroDe.nativeElement;
    
    // mock the hero supplied by the parent component
    expectedHero = {id: 42, name: 'Test Name'};
    
    // simulate the parent setting the input property with that hero
    comp.hero = expectedHero;
    
    // trigger initial data binding
    fixture.detectChanges();
    Docs
  • TestBed.configureTestingModule({
      declarations: [AppComponent, BookListComponent, BookCollectionComponent],
      imports: [
        HttpClientTestingModule,
        StoreModule.forRoot({
          books: booksReducer,
          collection: collectionReducer,
        }),
      ],
      providers: [GoogleBooksService],
    }).compileComponents();
     
    fixture = TestBed.createComponent(AppComponent);
    component = fixture.debugElement.componentInstance;
     
    fixture.detectChanges();
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples