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



Publicado 15 sept 2022

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 comentario

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

0


Iniciar sesión para dejar un comentario.

¿No encontró lo que buscaba?

Nueva publicación