Advertisement
kwandes

Angular Nebular component testing

Dec 16th, 2020 (edited)
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //app.component.spec.ts
  2. import { TestBed } from '@angular/core/testing';
  3. import { AppComponent } from './app.component';
  4. import {
  5.   NbLayoutModule,
  6.   NbSidebarModule,
  7.   NbInputModule,
  8.   NbMenuModule,
  9. } from '@nebular/theme';
  10.  
  11. import { NbThemeService } from '@nebular/theme';
  12. import { RouterTestingModule } from '@angular/router/testing';
  13. import { ThemeModule } from './@theme/theme.module';
  14.  
  15. describe('AppComponent', () => {
  16.   beforeEach(async () => {
  17.     TestBed.configureTestingModule({
  18.       declarations: [AppComponent],
  19.       imports: [
  20.         RouterTestingModule.withRoutes([]),
  21.         ThemeModule.forRoot(),
  22.         NbLayoutModule,
  23.         NbSidebarModule,
  24.         NbInputModule,
  25.         NbMenuModule,
  26.       ],
  27.       providers: [NbThemeService],
  28.     }).compileComponents();
  29.   });
  30.  
  31.   it('should create the app', () => {
  32.     const fixture = TestBed.createComponent(AppComponent);
  33.     const app = fixture.componentInstance;
  34.     expect(app).toBeTruthy();
  35.   });
  36. });
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement