From 47d59ea68a266f7eec296e855cedead7542ff122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Yves=20G=C3=A9rardy?= Date: Tue, 13 Jun 2017 23:30:12 +0200 Subject: [PATCH] [test-utils] Make throttleMock more reliable --- test-utils/throttleMock.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test-utils/throttleMock.js b/test-utils/throttleMock.js index 46076b28..06e74f99 100644 --- a/test-utils/throttleMock.js +++ b/test-utils/throttleMock.js @@ -14,8 +14,9 @@ module.exports = function() { } }, fire: function() { - queue.forEach(function(fn) {fn()}) - queue.length = 0 + var tasks = queue + queue = [] + tasks.forEach(function(fn) {fn()}) }, queueLength: function(){ return queue.length