feat(@angular/cli): add async method in Jasmine Tests blueprints (#4775)

This commit is contained in:
William KOZA 2017-02-21 23:29:11 +01:00 committed by Hans
parent d1e13ace0b
commit c792c9f8b8
3 changed files with 12 additions and 13 deletions

View File

@ -3,7 +3,7 @@ import { RouterTestingModule } from '@angular/router/testing';<% } %>
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
describe('AppComponent', () => { describe('AppComponent', () => {
beforeEach(() => { beforeEach(async(() => {
TestBed.configureTestingModule({<% if (routing) { %> TestBed.configureTestingModule({<% if (routing) { %>
imports: [ imports: [
RouterTestingModule RouterTestingModule
@ -11,9 +11,8 @@ describe('AppComponent', () => {
declarations: [ declarations: [
AppComponent AppComponent
], ],
}); }).compileComponents();
TestBed.compileComponents(); }));
});
it('should create the app', async(() => { it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);

View File

@ -77,17 +77,16 @@ export default function () {
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
describe('AppComponent', () => { describe('AppComponent', () => {
beforeEach(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
HttpModule HttpModule
], ],
declarations: [ declarations: [
AppComponent AppComponent
], ]
}); }).compileComponents();
TestBed.compileComponents(); }));
});
it('should create the app', async(() => { it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);

View File

@ -29,10 +29,11 @@ export default function () {
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
describe('AppComponent', () => { describe('AppComponent', () => {
beforeEach(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ declarations: [ AppComponent ] }); TestBed.configureTestingModule({
TestBed.compileComponents(); declarations: [ AppComponent ]
}); }).compileComponents();
}));
it('should have access to string-script.js', async(() => { it('should have access to string-script.js', async(() => {
let app = TestBed.createComponent(AppComponent).debugElement.componentInstance; let app = TestBed.createComponent(AppComponent).debugElement.componentInstance;