From 4dbf3a0271f4424cd607adb8fb1c15704e0c3e56 Mon Sep 17 00:00:00 2001 From: Martin Hickey Date: Tue, 21 Feb 2017 11:12:18 +0000 Subject: [PATCH] [test] call $timeout.flush() before debounce tests * Otherwise, the '$http GET' to fetch translation resources shows up as a deferred task here. * Referenced from: https://github.com/srl295/kibana/commit/5d9959cc3ec1c5db3a767143cf84f1ae3bb3a5e4 --- src/ui/public/debounce/__tests__/debounce.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ui/public/debounce/__tests__/debounce.js b/src/ui/public/debounce/__tests__/debounce.js index 9169c76a93568e..56663744168c38 100644 --- a/src/ui/public/debounce/__tests__/debounce.js +++ b/src/ui/public/debounce/__tests__/debounce.js @@ -15,6 +15,9 @@ function init() { $timeoutSpy = sinon.spy($timeout); debounce = $injector.get('debounce'); + + // ensure there is a clean slate before testing deferred tasks + $timeout.flush(); }); }