Matthias Mullie has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/353889 )

Change subject: Fix mmv.logging.ActionLogger qunit tests
......................................................................

Fix mmv.logging.ActionLogger qunit tests

Bug: T164473
Change-Id: I41f207519e27f63338298f68411fc2eb3eb7f13a
---
M tests/qunit/mmv/logging/mmv.logging.ActionLogger.test.js
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer 
refs/changes/89/353889/1

diff --git a/tests/qunit/mmv/logging/mmv.logging.ActionLogger.test.js 
b/tests/qunit/mmv/logging/mmv.logging.ActionLogger.test.js
index 5d6b4c5..e06e258 100644
--- a/tests/qunit/mmv/logging/mmv.logging.ActionLogger.test.js
+++ b/tests/qunit/mmv/logging/mmv.logging.ActionLogger.test.js
@@ -8,7 +8,8 @@
                        action1value = 'Test',
                        action2key = 'test-2',
                        action2value = 'Foo $1 $2 bar',
-                       unknownAction = 'test-3';
+                       unknownAction = 'test-3',
+                       clock = this.sandbox.useFakeTimers();
 
                this.sandbox.stub( logger, 'loadDependencies' ).returns( 
$.Deferred().resolve() );
                this.sandbox.stub( mw, 'log' );
@@ -20,6 +21,7 @@
                logger.logActions[ action2key ] = action2value;
 
                logger.log( unknownAction );
+               clock.tick( 10 );
 
                assert.strictEqual( mw.log.lastCall.args[ 0 ], unknownAction, 
'Log message defaults to unknown key' );
                assert.ok( fakeEventLog.logEvent.called, 'event log has been 
recorded' );
@@ -27,6 +29,7 @@
                mw.log.reset();
                fakeEventLog.logEvent.reset();
                logger.log( action1key );
+        clock.tick( 10 );
 
                assert.strictEqual( mw.log.lastCall.args[ 0 ], action1value, 
'Log message is translated to its text' );
                assert.ok( fakeEventLog.logEvent.called, 'event log has been 
recorded' );
@@ -35,8 +38,11 @@
                fakeEventLog.logEvent.reset();
                logger.samplingFactorMap = { 'default': 0 };
                logger.log( action1key, true );
+        clock.tick( 10 );
 
                assert.ok( !mw.log.called, 'No logging when disabled' );
                assert.ok( fakeEventLog.logEvent.called, 'event log has been 
recorded' );
+
+               clock.restore();
        } );
 }( mediaWiki, jQuery ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/353889
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I41f207519e27f63338298f68411fc2eb3eb7f13a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <mmul...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to