I'm submitting a ...
[x] bug report
[ ] feature request
[ ] support request
Current behavior
I'm trying to do some polling-like logic with a test, so I use a fakeAsync with tick() in the Jasmine test. But calling tick() does not resolve all asynchronous functions that is created during passage tick time.
Expected/desired behavior
tick() function should also resolve all the asynchronous functions that is created and should be executed during that time.
Reproduction of the problem
Here is the sample test:
it('tick should behave correctly', fakeAsync(() => {
let counter = 0;
const runner = () => {
counter++;
if (counter < 10) {
setTimeout(() => runner(), 10);
}
};
runner();
tick(10000);
expect(counter).toEqual(10);
}));
The test failed with 2 errors:
- Expected 2 to equal 10.
- Error: 1 timer(s) still in the queue.
What is the expected behavior?
The test should passes.
Current workaround for me is to use
for (let i = 0; i < 10000; i++) tick(1);
instead, which seems weird to me.
Please tell us about your environment:
- Angular version: 2.0.0-rc.4
- Browser: [Firefox | Chrome]
- Language: [TypeScript 1.8]
I'm submitting a ...
Current behavior
I'm trying to do some polling-like logic with a test, so I use a
fakeAsyncwithtick()in the Jasmine test. But callingtick()does not resolve all asynchronous functions that is created during passageticktime.Expected/desired behavior
tick()function should also resolve all the asynchronous functions that is created and should be executed during that time.Reproduction of the problem
Here is the sample test:
The test failed with 2 errors:
What is the expected behavior?
The test should passes.
Current workaround for me is to use
instead, which seems weird to me.
Please tell us about your environment: