/* Unit tests for the config directory */ import { assert } from 'chai' let currentEnv describe('#config', () => { before(() => { // Backup the current environment setting. currentEnv = process.env.BCH_DEX }) after(() => { // Restore the environment setting before starting these tests. process.env.BCH_DEX = currentEnv }) it('Should return development environment config by default', async () => { process.env.BCH_DEX = 'dev' const importedConfig = await import('../../../config/index.js?foo=bar3') const config = importedConfig.default // console.log('config: ', config) assert.equal(config.env, 'dev') }) it('Should return test environment config', async () => { // Hack to dynamically import a library multiple times: // https://github.com/denoland/deno/issues/6946 process.env.BCH_DEX = 'test' const importedConfig2 = await import('../../../config/index.js?foo=bar1') const config = importedConfig2.default // console.log('config: ', config) assert.equal(config.env, 'test') }) it('Should return prod environment config', async () => { process.env.BCH_DEX = 'prod' process.env.WALLET_INTERFACE = 'web2' process.env.APISERVER = 'https://api.fullstack.cash/v5/' await import('../../../config/env/common.js?foo=bar2') const importedConfig3 = await import('../../../config/index.js?foo=bar2') const config = importedConfig3.default // console.log('config: ', config) assert.equal(config.env, 'prod') }) })