Created
July 4, 2018 21:23
-
-
Save stewones/eddd875d2370235aeee68376fe224622 to your computer and use it in GitHub Desktop.
app component test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { TestBed, async } from '@angular/core/testing'; | |
import { AppComponent } from './app.component'; | |
import { MaterialModule } from './modules/material/material.module'; | |
import { ComponentsModule } from './components/components.module'; | |
import { AppRoutesModule } from './app.routes'; | |
import { APP_BASE_HREF } from '@angular/common'; | |
import { BotServiceModule, BotService } from './services/bot.service'; | |
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; | |
import { HttpClientModule } from '@angular/common/http'; | |
import { PipesModule } from './pipes/pipes.module'; | |
import { ReactiveFormsModule, FormsModule } from '@angular/forms'; | |
import { BrowserModule } from '@angular/platform-browser'; | |
const UI_BOOTSTRAP: any = { | |
"currencies": [ | |
"BTC", | |
"ETH" | |
], | |
"_id": "5ac2f5f353a9f077a81c1916", | |
"power": true, | |
"updated_at": "2018-04-03T03:33:07.323Z", | |
"__v": 0 | |
} | |
describe('AppComponent', () => { | |
beforeEach(async(() => { | |
TestBed.configureTestingModule({ | |
imports: [ | |
BrowserModule, | |
BrowserAnimationsModule, | |
AppRoutesModule, | |
FormsModule, | |
ReactiveFormsModule, | |
ComponentsModule, | |
MaterialModule, | |
PipesModule, | |
HttpClientModule, | |
BotServiceModule.forRoot() | |
], | |
declarations: [ | |
AppComponent | |
], | |
providers: [ | |
{ provide: APP_BASE_HREF, useValue: '/' } | |
] | |
}).compileComponents(); | |
})); | |
it('should create the app', async(() => { | |
const fixture = TestBed.createComponent(AppComponent); | |
const app = fixture.debugElement.componentInstance; | |
const botService = fixture.debugElement.injector.get(BotService); | |
spyOn(botService, 'bootstrap').and.returnValue(Promise.resolve(UI_BOOTSTRAP)); | |
expect(app).toBeTruthy(); | |
})); | |
// it(`should have as title 'app'`, async(() => { | |
// const fixture = TestBed.createComponent(AppComponent); | |
// const app = fixture.debugElement.componentInstance; | |
// expect(app.title).toEqual('app'); | |
// })); | |
// it('should render title in a h1 tag', async(() => { | |
// const fixture = TestBed.createComponent(AppComponent); | |
// fixture.detectChanges(); | |
// const compiled = fixture.debugElement.nativeElement; | |
// expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!'); | |
// })); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment