-
Notifications
You must be signed in to change notification settings - Fork 223
Open
Labels
Description
I think that while the ability to mock microtasks can be useful, most use-cases don't really care about this. Instead, people likely use fake_async for Duration based APIs like clocks or timers
By not mocking microtasks, this could allow writing things like:
await fakeAsync((async) async {
// random example showing how we can mix elapse and async/await
final repository = Repository(cacheTime: Duration(seconds: 5));
repository.cache = {'value': 42};
final response = await fetchSomething(repository); // would otherwise block if microtasks were mocked
expect(response.value, 42);
async.elapse(Duration(seconds: 5));
expect(repository.cache, null);
});Unless I'm missing something important and mocking microtasks is necessary for proper Timer mock, I think this behavior would be more intuitive for users.
gabrielgarciagava, stevenspiel, passsy, ebkn, evaissebrs and 2 more