From c51bb93320d5836525ddb04c0eb059c6084b59b6 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 2 Jun 2023 16:09:38 +0100 Subject: [PATCH] tests: Modernize test syntax * Remove redundant file closure. * Remove needless QUnit.newMwEnvironment() calls as the tested methods don't alter mw.config or mw.messages. Slow, as per https://gerrit.wikimedia.org/r/c/mediawiki/core/+/912936/ Change-Id: I61bf03325d5067568d057ff2af6bf65f279a8a84 --- .../qunit/model/test_mw.echo.dm.NotificationItem.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/qunit/model/test_mw.echo.dm.NotificationItem.js b/tests/qunit/model/test_mw.echo.dm.NotificationItem.js index daabb36af..67e141e8c 100644 --- a/tests/qunit/model/test_mw.echo.dm.NotificationItem.js +++ b/tests/qunit/model/test_mw.echo.dm.NotificationItem.js @@ -1,4 +1,4 @@ -( function () { +QUnit.module( 'ext.echo.dm - NotificationItem', function ( hooks ) { var fakeData = { type: 'alert', read: true, @@ -28,11 +28,9 @@ var now = 1234567890000; var nowFormatted = '2009-02-13T23:31:30Z'; - QUnit.module( 'ext.echo.dm - NotificationItem', QUnit.newMwEnvironment( { - beforeEach: function () { - this.sandbox.useFakeTimers( now ); - } - } ) ); + hooks.beforeEach( function () { + this.sandbox.useFakeTimers( now ); + } ); QUnit.test.each( 'Constructing items', { 'Empty data': { @@ -137,4 +135,4 @@ ); } ); -}() ); +} );