aboutsummaryrefslogtreecommitdiffstats
path: root/test/ngMock/angular-mocksSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/ngMock/angular-mocksSpec.js')
-rw-r--r--test/ngMock/angular-mocksSpec.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ngMock/angular-mocksSpec.js b/test/ngMock/angular-mocksSpec.js
index 5992846d..d95f3003 100644
--- a/test/ngMock/angular-mocksSpec.js
+++ b/test/ngMock/angular-mocksSpec.js
@@ -327,6 +327,22 @@ describe('ngMock', function() {
$timeout.flush();
expect(logger).toEqual(['t1', 't3', 't2']);
}));
+
+
+ it('should throw an exception when not flushed', inject(function($timeout){
+ $timeout(noop);
+
+ var expectedError = 'Deferred tasks to flush (1): {id: 0, time: 0}';
+ expect(function() {$timeout.verifyNoPendingTasks();}).toThrow(expectedError);
+ }));
+
+
+ it('should do nothing when all tasks have been flushed', inject(function($timeout) {
+ $timeout(noop);
+
+ $timeout.flush();
+ expect(function() {$timeout.verifyNoPendingTasks();}).not.toThrow();
+ }));
});