Skip to content

Commit 872bd48

Browse files
committed
test: update generated tests to not use async helper function
1 parent f463c84 commit 872bd48

File tree

10 files changed

+80
-80
lines changed

10 files changed

+80
-80
lines changed

integration/angular_cli/src/app/app.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { TestBed, async } from '@angular/core/testing';
1+
import { TestBed } from '@angular/core/testing';
22
import { AppComponent } from './app.component';
33

44
describe('AppComponent', () => {
5-
beforeEach(async(() => {
6-
TestBed.configureTestingModule({
5+
beforeEach(async () => {
6+
await TestBed.configureTestingModule({
77
declarations: [
88
AppComponent
99
],
1010
}).compileComponents();
11-
}));
11+
});
1212

1313
it('should create the app', () => {
1414
const fixture = TestBed.createComponent(AppComponent);

packages/angular_devkit/build_angular/src/karma/works_spec.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,24 @@ describe('Karma Builder', () => {
6464
}
6565
`,
6666
'src/app/app.component.spec.ts': `
67-
import { TestBed, async } from '@angular/core/testing';
67+
import { TestBed } from '@angular/core/testing';
6868
import { AppComponent } from './app.component';
6969
7070
describe('AppComponent', () => {
71-
beforeEach(async(() => {
72-
TestBed.configureTestingModule({
71+
beforeEach(async () => {
72+
await TestBed.configureTestingModule({
7373
imports: [
7474
],
7575
declarations: [
7676
AppComponent
7777
]
7878
}).compileComponents();
79-
}));
79+
});
8080
81-
it('should not contain text that is hidden via css', async(() => {
81+
it('should not contain text that is hidden via css', () => {
8282
const fixture = TestBed.createComponent(AppComponent);
8383
expect(fixture.nativeElement.innerText).not.toContain('Hello World');
84-
}));
84+
});
8585
});`,
8686
});
8787

@@ -143,27 +143,27 @@ describe('Karma Builder', () => {
143143
}
144144
}`,
145145
'src/app/app.component.spec.ts': `
146-
import { TestBed, async } from '@angular/core/testing';
146+
import { TestBed } from '@angular/core/testing';
147147
import { HttpClientModule } from '@angular/common/http';
148148
import { AppComponent } from './app.component';
149149
150150
describe('AppComponent', () => {
151-
beforeEach(async(() => {
152-
TestBed.configureTestingModule({
151+
beforeEach(async () => {
152+
await TestBed.configureTestingModule({
153153
imports: [
154154
HttpClientModule
155155
],
156156
declarations: [
157157
AppComponent
158158
]
159159
}).compileComponents();
160-
}));
160+
});
161161
162-
it('should create the app', async(() => {
162+
it('should create the app', () => {
163163
const fixture = TestBed.createComponent(AppComponent);
164164
const app = fixture.debugElement.componentInstance;
165165
expect(app).toBeTruthy();
166-
}));
166+
});
167167
});`,
168168
});
169169

packages/angular_devkit/build_angular/test/hello-world-app/src/app/app.component.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
import { TestBed, async } from '@angular/core/testing';
8+
import { TestBed } from '@angular/core/testing';
99
import { AppComponent } from './app.component';
1010
describe('AppComponent', () => {
11-
beforeEach(async(() => {
12-
TestBed.configureTestingModule({
11+
beforeEach(async () => {
12+
await TestBed.configureTestingModule({
1313
declarations: [AppComponent],
1414
}).compileComponents();
15-
}));
16-
it('should create the app', async(() => {
15+
});
16+
it('should create the app', () => {
1717
const fixture = TestBed.createComponent(AppComponent);
1818
const app = fixture.debugElement.componentInstance;
1919
expect(app).toBeTruthy();
20-
}));
21-
it(`should have as title 'app'`, async(() => {
20+
});
21+
it(`should have as title 'app'`, () => {
2222
const fixture = TestBed.createComponent(AppComponent);
2323
const app = fixture.debugElement.componentInstance;
2424
expect(app.title).toEqual('app');
25-
}));
26-
it('should render title in a h1 tag', async(() => {
25+
});
26+
it('should render title in a h1 tag', () => {
2727
const fixture = TestBed.createComponent(AppComponent);
2828
fixture.detectChanges();
2929
const compiled = fixture.debugElement.nativeElement;
3030
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
31-
}));
31+
});
3232
});

packages/angular_devkit/build_ng_packagr/test/ng-packaged/projects/lib/src/lib/lib.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
8+
import { ComponentFixture, TestBed } from '@angular/core/testing';
99

1010
import { LibComponent } from './lib.component';
1111

1212
describe('LibComponent', () => {
1313
let component: LibComponent;
1414
let fixture: ComponentFixture<LibComponent>;
1515

16-
beforeEach(async(() => {
17-
TestBed.configureTestingModule({
16+
beforeEach(async () => {
17+
await TestBed.configureTestingModule({
1818
declarations: [ LibComponent ]
1919
})
2020
.compileComponents();
21-
}));
21+
});
2222

2323
beforeEach(() => {
2424
fixture = TestBed.createComponent(LibComponent);

packages/angular_devkit/build_webpack/test/angular-app/src/app/app.component.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
import { TestBed, async } from '@angular/core/testing';
8+
import { TestBed } from '@angular/core/testing';
99
import { AppComponent } from './app.component';
1010
describe('AppComponent', () => {
11-
beforeEach(async(() => {
12-
TestBed.configureTestingModule({
11+
beforeEach(async () => {
12+
await TestBed.configureTestingModule({
1313
declarations: [
1414
AppComponent
1515
],
1616
}).compileComponents();
17-
}));
18-
it('should create the app', async(() => {
17+
});
18+
it('should create the app', () => {
1919
const fixture = TestBed.createComponent(AppComponent);
2020
const app = fixture.debugElement.componentInstance;
2121
expect(app).toBeTruthy();
22-
}));
23-
it(`should have as title 'app'`, async(() => {
22+
});
23+
it(`should have as title 'app'`, () => {
2424
const fixture = TestBed.createComponent(AppComponent);
2525
const app = fixture.debugElement.componentInstance;
2626
expect(app.title).toEqual('app');
27-
}));
28-
it('should render title in a h1 tag', async(() => {
27+
});
28+
it('should render title in a h1 tag', () => {
2929
const fixture = TestBed.createComponent(AppComponent);
3030
fixture.detectChanges();
3131
const compiled = fixture.debugElement.nativeElement;
3232
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
33-
}));
33+
});
3434
});
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
import { TestBed, async } from '@angular/core/testing';
1+
import { TestBed } from '@angular/core/testing';
22

33
import { AppComponent } from './app.component';
44

55
describe('AppComponent', () => {
6-
beforeEach(async(() => {
7-
TestBed.configureTestingModule({
6+
beforeEach(async () => {
7+
await TestBed.configureTestingModule({
88
declarations: [
99
AppComponent
1010
],
1111
}).compileComponents();
12-
}));
12+
});
1313

14-
it('should create the app', async(() => {
14+
it('should create the app', () => {
1515
const fixture = TestBed.createComponent(AppComponent);
1616
const app = fixture.debugElement.componentInstance;
1717
expect(app).toBeTruthy();
18-
}));
18+
});
1919

20-
it(`should have as title 'app works!'`, async(() => {
20+
it(`should have as title 'app works!'`, () => {
2121
const fixture = TestBed.createComponent(AppComponent);
2222
const app = fixture.debugElement.componentInstance;
2323
expect(app.title).toEqual('app works!');
24-
}));
24+
});
2525

26-
it('should render title in a h1 tag', async(() => {
26+
it('should render title in a h1 tag', () => {
2727
const fixture = TestBed.createComponent(AppComponent);
2828
fixture.detectChanges();
2929
const compiled = fixture.debugElement.nativeElement;
3030
expect(compiled.querySelector('h1').textContent).toContain('app works!');
31-
}));
31+
});
3232
});
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
import { TestBed, async } from '@angular/core/testing';
1+
import { TestBed } from '@angular/core/testing';
22
import { AppComponent } from './app.component';
33
describe('AppComponent', () => {
4-
beforeEach(async(() => {
5-
TestBed.configureTestingModule({
4+
beforeEach(async () => {
5+
await TestBed.configureTestingModule({
66
declarations: [
77
AppComponent
88
],
99
}).compileComponents();
10-
}));
11-
it('should create the app', async(() => {
10+
});
11+
it('should create the app', () => {
1212
const fixture = TestBed.createComponent(AppComponent);
1313
const app = fixture.debugElement.componentInstance;
1414
expect(app).toBeTruthy();
15-
}));
16-
it(`should have as title 'app'`, async(() => {
15+
});
16+
it(`should have as title 'app'`, () => {
1717
const fixture = TestBed.createComponent(AppComponent);
1818
const app = fixture.debugElement.componentInstance;
1919
expect(app.title).toEqual('app');
20-
}));
21-
it('should render title in a h1 tag', async(() => {
20+
});
21+
it('should render title in a h1 tag', () => {
2222
const fixture = TestBed.createComponent(AppComponent);
2323
fixture.detectChanges();
2424
const compiled = fixture.debugElement.nativeElement;
2525
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
26-
}));
26+
});
2727
});

tests/legacy-cli/e2e/assets/7.0-project/src/app/app.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import { TestBed, async } from '@angular/core/testing';
1+
import { TestBed } from '@angular/core/testing';
22
import { RouterModule } from '@angular/router';
33
import { AppComponent } from './app.component';
44

55
describe('AppComponent', () => {
6-
beforeEach(async(() => {
7-
TestBed.configureTestingModule({
6+
beforeEach(async () => {
7+
await TestBed.configureTestingModule({
88
declarations: [
99
AppComponent
1010
],
1111
imports: [
1212
RouterModule.forRoot([])
1313
],
1414
}).compileComponents();
15-
}));
15+
});
1616

1717
it('should create the app', () => {
1818
const fixture = TestBed.createComponent(AppComponent);

tests/legacy-cli/e2e/assets/7.0-project/src/app/lazy/lazy-comp/lazy-comp.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
22

33
import { LazyCompComponent } from './lazy-comp.component';
44

55
describe('LazyCompComponent', () => {
66
let component: LazyCompComponent;
77
let fixture: ComponentFixture<LazyCompComponent>;
88

9-
beforeEach(async(() => {
10-
TestBed.configureTestingModule({
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
1111
declarations: [ LazyCompComponent ]
1212
})
1313
.compileComponents();
14-
}));
14+
});
1515

1616
beforeEach(() => {
1717
fixture = TestBed.createComponent(LazyCompComponent);

tests/legacy-cli/e2e/tests/test/test-scripts.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,35 @@ export default function () {
2828
}
2929
`,
3030
'src/app/app.component.spec.ts': stripIndent`
31-
import { TestBed, async } from '@angular/core/testing';
31+
import { TestBed } from '@angular/core/testing';
3232
import { AppComponent } from './app.component';
3333
3434
describe('AppComponent', () => {
35-
beforeEach(async(() => {
36-
TestBed.configureTestingModule({
35+
beforeEach(async () => {
36+
await TestBed.configureTestingModule({
3737
declarations: [ AppComponent ]
3838
}).compileComponents();
39-
}));
39+
});
4040
41-
it('should have access to string-script.js', async(() => {
41+
it('should have access to string-script.js', () => {
4242
let app = TestBed.createComponent(AppComponent).debugElement.componentInstance;
4343
expect(app.stringScriptGlobalProp).toEqual('string-scripts.js');
44-
}));
44+
});
4545
46-
it('should have access to input-script.js', async(() => {
46+
it('should have access to input-script.js', () => {
4747
let app = TestBed.createComponent(AppComponent).debugElement.componentInstance;
4848
expect(app.inputScriptGlobalProp).toEqual('input-scripts.js');
49-
}));
49+
});
5050
});
5151
5252
describe('Spec', () => {
53-
it('should have access to string-script.js', async(() => {
53+
it('should have access to string-script.js', () => {
5454
expect(stringScriptGlobal).toBe('string-scripts.js');
55-
}));
55+
});
5656
57-
it('should have access to input-script.js', async(() => {
57+
it('should have access to input-script.js', () => {
5858
expect(inputScriptGlobal).toBe('input-scripts.js');
59-
}));
59+
});
6060
});
6161
`
6262
}))

0 commit comments

Comments
 (0)