I'm trying to get the results from a mock backend in Angular 2 for unit testing. Currently, we are using `fakeAsync` with a timeout to simulate the passing of time. 

**current working unit test**

```
it('timeout (fakeAsync/tick)', fakeAsync(() => {
    counter.getTimeout();
    tick(3000); //manually specify the waiting time
}));

```

But, this means that we are limited to a manually defined timeout. Not when the async task is completed. What I'm trying to do is getting `tick()` to wait until the task is completed before continuing with the test. 

This does not seem to work as intended. 

Reading up on the `fakeAsync` and `tick` the answer [here](https://stackoverflow.com/a/35991133/3156644) explains that: 

> 
> tick() simulates the asynchronous passage of time.
> 
> 
> 

I set up a [plnkr example](https://plnkr.co/edit/jm6T17qPbzM8abmRMckw?p=preview) simulating this scenario. 

Here, we call the `getTimeout()` method which calls an internal async task that has a timeout. In the test, we try wrapping it and calling `tick()` after calling the `getTimeout()` method. 

**counter.ts**

```
getTimeout() {
  setTimeout(() => {
    console.log('timeout')
  },3000)
}

```

**counter.specs.ts**

```
it('timeout (fakeAsync/tick)', fakeAsync(() => {
    counter.getTimeout();
    tick();
}));

```

But, the unit test fails with the error "Error: 1 timer(s) still in the queue."

Does the [issue here in the angular repo](https://github.com/angular/angular/issues/10127) have anything to do with this?

Is it possible to use `tick()` this way to wait for a timeout function? Or is there another approach that I can use?