Răsfoiți Sursa

Remove useless variable declaration. Cleanup recently updated test.

Maksymilian Barnaś 9 ani în urmă
părinte
comite
9197f26414
2 a modificat fișierele cu 4 adăugiri și 3 ștergeri
  1. 1 2
      dev/tasks/dev/utils/sanitize.js
  2. 3 1
      dev/tests/dev/sanitize.js

+ 1 - 2
dev/tasks/dev/utils/sanitize.js

@@ -8,9 +8,8 @@
 module.exports = {
 	appendPeriodIfMissing( text ) {
 		text = text.trim();
-		const length = text.length;
 
-		if ( length > 0 && !text.endsWith( '.' ) ) {
+		if ( text.length > 0 && !text.endsWith( '.' ) ) {
 			text += '.';
 		}
 

+ 3 - 1
dev/tests/dev/sanitize.js

@@ -42,7 +42,9 @@ describe( 'utils', () => {
 			} );
 
 			it( 'should return empty string when invoked with empty string', () => {
-				expect( sanitize.appendPeriodIfMissing( '' ) ).to.equal( '' );
+				const sanitized = sanitize.appendPeriodIfMissing( '' );
+
+				expect( sanitized ).to.equal( '' );
 			} );
 		} );
 	} );