diff --git a/jest.config.js b/jest.config.js index 16da9dd5..c689f5b9 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,7 +3,7 @@ module.exports = { testPathIgnorePatterns: ['/node_modules/', '/config/'], // Require .env file and additional setup - setupFiles: ['dotenv/config', '/jest.setup.js'], + setupFiles: ['dotenv/config'], // Resolve modules same as Webpack moduleNameMapper: { diff --git a/jest.setup.js b/jest.setup.js deleted file mode 100644 index 78f8a345..00000000 --- a/jest.setup.js +++ /dev/null @@ -1,23 +0,0 @@ -require('dotenv').config(); -const Web3 = require('web3'); -const web3 = new Web3(); - -// Validate required environment variables -const requiredEnvVars = [ - 'API_SERVICE_EXTERNAL', - 'SAFE_DEFAULT_CALLBACK_HANDLER', - 'GRAPH_NODE_EXTERNAL', - 'HUB_ADDRESS', - 'PATHFINDER_SERVICE_ENDPOINT', - 'PATHFINDER_TYPE', - 'PROXY_FACTORY_ADDRESS', - 'RELAY_SERVICE_EXTERNAL', - 'SAFE_ADDRESS', - 'SUBGRAPH_NAME', -]; - -requiredEnvVars.forEach((varName) => { - if (!process.env[varName]) { - throw new Error(`Environment variable ${varName} is not set`); - } -}); diff --git a/src/services/core.js b/src/services/core.js index 420f3912..9e255513 100644 --- a/src/services/core.js +++ b/src/services/core.js @@ -1,19 +1,14 @@ -require('dotenv').config(); import CirclesCore from '@circles/core'; import { getAccount } from '~/services/wallet'; import web3 from '~/services/web3'; import { PATHFINDER_HOPS_DEFAULT } from '~/utils/constants'; -if (!process.env.HUB_ADDRESS || typeof process.env.HUB_ADDRESS !== 'string') { - throw new Error('HUB_ADDRESS is not set or not a string'); -} - const core = new CirclesCore(web3, { apiServiceEndpoint: process.env.API_SERVICE_EXTERNAL, fallbackHandlerAddress: process.env.SAFE_DEFAULT_CALLBACK_HANDLER, graphNodeEndpoint: process.env.GRAPH_NODE_EXTERNAL, - hubAddress: String(process.env.HUB_ADDRESS), + hubAddress: process.env.HUB_ADDRESS, pathfinderServiceEndpoint: process.env.PATHFINDER_SERVICE_ENDPOINT, pathfinderType: process.env.PATHFINDER_TYPE, proxyFactoryAddress: process.env.PROXY_FACTORY_ADDRESS, diff --git a/webpack.config.babel.js b/webpack.config.babel.js index 72c6421f..3d88b263 100644 --- a/webpack.config.babel.js +++ b/webpack.config.babel.js @@ -5,7 +5,6 @@ import HtmlWebpackPlugin from 'html-webpack-plugin'; import TerserPlugin from 'terser-webpack-plugin'; import webpack from 'webpack'; -// Load environment variables dotenv.config(); const PAGE_TITLE = 'Circles UBI | Wallet';