Explorar o código

Tests: Fix Clock unit tests under latest node. (#21730)

Michael Herzog %!s(int64=4) %!d(string=hai) anos
pai
achega
608c8057fe
Modificáronse 1 ficheiros con 20 adicións e 18 borrados
  1. 20 18
      test/unit/src/core/Clock.tests.js

+ 20 - 18
test/unit/src/core/Clock.tests.js

@@ -8,7 +8,9 @@ export default QUnit.module( 'Core', () => {
 
 
 		function mockPerformance() {
 		function mockPerformance() {
 
 
-			self.performance = {
+			const reference = ( typeof global !== 'undefined' ) ? global : self;
+
+			reference.performance = {
 				deltaTime: 0,
 				deltaTime: 0,
 
 
 				next: function ( delta ) {
 				next: function ( delta ) {
@@ -28,39 +30,39 @@ export default QUnit.module( 'Core', () => {
 		}
 		}
 
 
 		// INSTANCING
 		// INSTANCING
-		QUnit.todo( "Instancing", ( assert ) => {
+		QUnit.todo( 'Instancing', ( assert ) => {
 
 
-			assert.ok( false, "everything's gonna be alright" );
+			assert.ok( false, 'everything\'s gonna be alright' );
 
 
 		} );
 		} );
 
 
 		// PUBLIC STUFF
 		// PUBLIC STUFF
-		QUnit.todo( "start", ( assert ) => {
+		QUnit.todo( 'start', ( assert ) => {
 
 
-			assert.ok( false, "everything's gonna be alright" );
+			assert.ok( false, 'everything\'s gonna be alright' );
 
 
 		} );
 		} );
 
 
-		QUnit.todo( "stop", ( assert ) => {
+		QUnit.todo( 'stop', ( assert ) => {
 
 
-			assert.ok( false, "everything's gonna be alright" );
+			assert.ok( false, 'everything\'s gonna be alright' );
 
 
 		} );
 		} );
 
 
-		QUnit.todo( "getElapsedTime", ( assert ) => {
+		QUnit.todo( 'getElapsedTime', ( assert ) => {
 
 
-			assert.ok( false, "everything's gonna be alright" );
+			assert.ok( false, 'everything\'s gonna be alright' );
 
 
 		} );
 		} );
 
 
-		QUnit.todo( "getDelta", ( assert ) => {
+		QUnit.todo( 'getDelta', ( assert ) => {
 
 
-			assert.ok( false, "everything's gonna be alright" );
+			assert.ok( false, 'everything\'s gonna be alright' );
 
 
 		} );
 		} );
 
 
 		// OTHERS
 		// OTHERS
-		QUnit.test( "clock with performance", ( assert ) => {
+		QUnit.test( 'clock with performance', ( assert ) => {
 
 
 			if ( typeof performance === 'undefined' ) {
 			if ( typeof performance === 'undefined' ) {
 
 
@@ -75,16 +77,16 @@ export default QUnit.module( 'Core', () => {
 
 
 			clock.start();
 			clock.start();
 
 
-			self.performance.next( 123 );
-			assert.numEqual( clock.getElapsedTime(), 0.123, "okay" );
+			performance.next( 123 );
+			assert.numEqual( clock.getElapsedTime(), 0.123, 'okay' );
 
 
-			self.performance.next( 100 );
-			assert.numEqual( clock.getElapsedTime(), 0.223, "okay" );
+			performance.next( 100 );
+			assert.numEqual( clock.getElapsedTime(), 0.223, 'okay' );
 
 
 			clock.stop();
 			clock.stop();
 
 
-			self.performance.next( 1000 );
-			assert.numEqual( clock.getElapsedTime(), 0.223, "don't update time if the clock was stopped" );
+			performance.next( 1000 );
+			assert.numEqual( clock.getElapsedTime(), 0.223, 'don\'t update time if the clock was stopped' );
 
 
 		} );
 		} );