Error-ZAFClient is not defined appears while unit test execution.
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.
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
If you're using webpack, you'll have to add it as external:
Hi Nitin Daphale,
As far as I know, ZAFClient cannot run outside Zendesk and is not possible to import as a nodeJs module.
Please sign in to leave a comment.