Reactjs 无法在笑话中模拟常量

Reactjs 无法在笑话中模拟常量,reactjs,jestjs,enzyme,Reactjs,Jestjs,Enzyme,我们正在试图模仿const。 我们有一个configparam.js文件 变量ConfigParam= { “APIUrl”:“https” } 我们正在index.html中导入configparam.js 我们正在config.js文件中导入configparam.js。 export const ChrysalisContext=window.ConfigParam; 我们正在导入组件A中的config.js文件 const API=ChrysalisContext.apirl; 类Com

我们正在试图模仿const。
我们有一个configparam.js文件 变量ConfigParam= { “APIUrl”:“https” }

我们正在index.html中导入configparam.js
我们正在config.js文件中导入configparam.js。
export const ChrysalisContext=window.ConfigParam;
我们正在导入组件A中的config.js文件
const API=ChrysalisContext.apirl;
类ComponentA扩展了组件{
建造师(道具){
超级(道具);
}
}
现在,我们正在尝试使用Jest酶模拟成分A,您能帮助我如何模拟恒定的ChrysalisContext吗

请发布您的测试代码。
we are importing configparam.js in index.html
<script src="configParam.js"></script>

We are importing the configparam.js in config.js file.
export const ChrysalisContext=window.ConfigParam;

We are importing  config.js file in Component A

const API = ChrysalisContext.APIUrl;

class ComponentA extends Component {
  constructor(props) {
    super(props);
}
}

Now we are trying to mock the ComponentA using Jest Enzyme , Could you help me how can we mock the constant ChrysalisContext