fixed ISSUE-44752: global scope used in jest test
authorAsier Lostalé <asier.lostale@openbravo.com>
Wed, 05 Aug 2020 08:17:58 +0200
changeset 37506 d6655bf58677
parent 37505 ee614b0e157d
child 37507 19361bd9dc0e
fixed ISSUE 44752: global scope used in jest test

Prevent using global scope in jest test by replacing its usage by global
object.
modules/org.openbravo.client.application/web-test/ob-utilities-number.test.js
modules/org.openbravo.client.application/web-test/ob-utilities-validUrl.test.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-date.js
--- a/modules/org.openbravo.client.application/web-test/ob-utilities-number.test.js	Fri Jul 31 08:47:06 2020 +0000
+++ b/modules/org.openbravo.client.application/web-test/ob-utilities-number.test.js	Wed Aug 05 08:17:58 2020 +0200
@@ -16,7 +16,10 @@
  * Contributor(s):  ______________________________________.
  ************************************************************************
  */
-OB = {
+
+/* global global */
+
+global.OB = {
   I18N: {
     getLabel: jest.fn()
   }
--- a/modules/org.openbravo.client.application/web-test/ob-utilities-validUrl.test.js	Fri Jul 31 08:47:06 2020 +0000
+++ b/modules/org.openbravo.client.application/web-test/ob-utilities-validUrl.test.js	Wed Aug 05 08:17:58 2020 +0200
@@ -16,7 +16,10 @@
  * Contributor(s):  ______________________________________.
  ************************************************************************
  */
-OB = {};
+
+/* global global */
+
+global.OB = {};
 require('../web/org.openbravo.client.application/js/utilities/ob-utilities');
 
 describe('OB.Utilities.isValidUrl', () => {
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-date.js	Fri Jul 31 08:47:06 2020 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-date.js	Wed Aug 05 08:17:58 2020 +0200
@@ -17,7 +17,7 @@
  ************************************************************************
  */
 
-OB = window.OB || {};
+window.OB = window.OB || {};
 OB.Utilities = window.OB.Utilities || {};
 
 // = Openbravo Date Utilities =