Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from "@angular/router/testing";
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from "@angular/platform-browser-dynamic/testing";
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { MyService1, MyService2, MyService3, MyService4, MyService5, MyService6, SomeClass } from '../comun/services';
import { Ng2Bs3ModalModule } from "ng2-bs3-modal/ng2-bs3-modal";
import { MyTestingComponent } from './my-testing-component.component';
import { BaseRequestOptions, Http, ConnectionBackend } from "@angular/http";
import { MyComponent1,MyComponent2,MyComponent3,MyComponent4,MyComponent5,MyComponent6,MyComponent7 } from '../comun/vistas';
import { SomeClasssComponent } from "../SomeClasss";
import { KeycloakService } from "../comun/keycloak";
import { MyModal, ErroresComponent } from "../comun/alerts";
import { MyPipe1,MyPipe2,MyPipe3,MyPipe4,MyPipe5,MyPipe6,MyPipe7,MyPipe8,MyPipe9 } from "../comun/pipes";
import { MockBackend} from "@angular/http/testing";
describe('MyTestingComponent', () => {
let component: MyTestingComponent;
let fixture: ComponentFixture<MyTestingComponent>;
beforeEach(async(() => {
TestBed.resetTestEnvironment();
TestBed.initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
TestBed.configureTestingModule({
declarations: [
MyTestingComponent,
MyComponent1,
MyComponent2,
MyComponent3,
MyComponent4,
MyComponent5,
MyComponent6,
MyComponent7,
SomeClasssComponent,
MyModal,
ErroresComponent,
MyPipe1,
MyPipe2,
MyPipe3 MyPipe4 MyPipe5 MyPipe6, MyPipe7, MyPipe8, MyPipe9 ], imports: [
RouterTestingModule,
FormsModule,
ReactiveFormsModule,
Ng2Bs3ModalModule
],
providers: [
KeycloakService,
MyService1,
MyService2,
MyService3,
MyService4,
MyService5,
MyService6,
{
provide: SomeClass,
useFactory: () => {
return new SomeClass("", "");
}
},
{
provide: ConnectionBackend,
useClass: MockBackend
},
{
provide: BaseRequestOptions,
useClass: BaseRequestOptions
},
{
provide: Http,
useFactory: (backend: ConnectionBackend, defaultOptions: BaseRequestOptions) => {
return new Http(backend, defaultOptions);
},
deps: [ConnectionBackend, BaseRequestOptions]
}
]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(MyTestingComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.