Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit c834837

Browse files
committed
feat(mock zone): isAsyncQueueEmpty
1 parent 86953d0 commit c834837

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

lib/mock/zone.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ microLeap() {
4646
}
4747
}
4848

49+
/**
50+
* Returns whether the async queue is empty.
51+
*/
52+
isAsyncQueueEmpty() => _asyncQueue.isEmpty;
53+
4954
/**
5055
* Simulates a clock tick by running any scheduled timers. Can only be used
5156
* in [async] tests.Clock tick will call [microLeap] to process the microtask

test/mock/zone_spec.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ void main() {
4242
async(() {
4343
new Future.value('s').then((_) { thenRan = true; });
4444
expect(thenRan).toBe(false);
45+
expect(isAsyncQueueEmpty()).toBe(false);
4546
microLeap();
47+
expect(isAsyncQueueEmpty()).toBe(true);
4648
expect(thenRan).toBe(true);
4749
ran = true;
4850
})();

0 commit comments

Comments
 (0)