vendredi 5 avril 2019

Integrate Jest into an Angular 5

I am setting up test and want to integrate Jest into an Angular 5. I have a problem. Thanks in advance for your help!

enter image description here

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import 'jest';
import { LoginComponent } from './login.component';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { APP_BASE_HREF } from '@angular/common';
import { AuthenticationService, UserService } from 

'../../shared/services/index';
import { HttpModule } from '@angular/http';
import { AppConfig } from '../../app.config';
import { PermissionsService } from '../../shared/services/permissions.service';

describe('LoginComponent', () => {
  let component: LoginComponent;
  let fixture: ComponentFixture<LoginComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [
        FormsModule,
        TranslateModule,
        NgbModule,
        RouterModule.forRoot([]),
        HttpModule
      ],
      declarations: [LoginComponent],
      providers: [{
        provide: APP_BASE_HREF,
        useValue: '/',
      },
        AuthenticationService,
        PermissionsService,
        UserService,
        AppConfig],
    });
    fixture = TestBed.createComponent(LoginComponent);
    component = fixture.componentInstance;
  }));

  test('should create', () => {
    expect(component).toBeDefined();
  });
});

Hello, I want integrate Jest into an Angular 5. I have a problem: Thanks in advance for your help!

Aucun commentaire:

Enregistrer un commentaire