Error-ZAFClient is not defined appears while unit test execution.



2022년 9월 15일에 게시됨

I am writing a unit test for a component in which I use ZAFClient.

While executing the unit test case, gets error message "ZAFClient is not defined".

In the component, I am able to access/declare the ZAFClient since below script tag included in parent component.

<Helmet>
<script
type="text/javascript"
></script>
</Helmet>
 
Not sure how to mock ZAFClient if it is inserted via script!

Can I import the ZAFClient in module way ex. Import ZAFClient from "pathToZAF". If so then I would import it in my unit test case and mock it.

 

Using below technology stack-

  • React component with Fusion.js
  •  

 

 


0

1

댓글 1개

If you're using webpack, you'll have to add it as external:
https://webpack.js.org/configuration/externals/

0


로그인하세요.

원하는 정보를 못 찾으셨나요?

새 게시물