I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:
Current behavior
When using async await with promises (and therefore: this.http.get(...).toPromise()), one can unittest everything like normal with the HttpTestingController. BUT if you have a service method that has multiple await in it, the testing controller is not aware of the later executed await and will just wait and fail.
Expected behavior
All await calls inside a method should be executed during async testing.
Minimal reproduction of the problem with instructions
- use a service with async await function like:
@Injectable()
class Service {
constructor(private http: HttpClient){}
public async foobar(): Promise<number> {
await Promise.resolve();
await Promise.resolve();
await this.http.get('http://asdf').toPromise();
return 1;
}
}
- try to use the
HttpTestingClient to catch the http://asdf request.
Environment
Angular version: 6.1.0
Browser:
- [x ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
I'm submitting a...
Current behavior
When using async await with promises (and therefore:
this.http.get(...).toPromise()), one can unittest everything like normal with theHttpTestingController. BUT if you have a service method that has multipleawaitin it, the testing controller is not aware of the later executedawaitand will just wait and fail.Expected behavior
All await calls inside a method should be executed during async testing.
Minimal reproduction of the problem with instructions
HttpTestingClientto catch thehttp://asdfrequest.Environment