Expand my Community achievements bar.

How to unit test dialog field js(custom js files for dialog fields) files which has references to granite library

Avatar

Level 2

Hi,

We are implementing the java script unit test case on one of the custom JS file written for text field in component dialog which has references to Granite library as one of its parameters.So, when we are writing test case, it is throwing reference error on Granite variable.

Can somebody suggest us how to reference the out of the box Granite library  while writing java script unit test cases or if anybody has done this kind of implementation please let us know how you have implemented.

Following are the libraries we are using to write the test cases

Mocha/Chai, Sinon, JsDom

Thanks,

Madhu

2 Replies

Avatar

Level 10

I am not sure there is anything different about using the JS framework to test AEM content. We do not have any docs or discussions about using these frameworks to test AEM JS files. 

Avatar

Level 2

Thanks for reply Scott,

We stuck up with how to handle the "granite" reference present in custom JS file developed for Text Field. We are in thought of , is there any way to import the reference to this library. So , that while running the test case it will not throw error.

Thanks,

Madhu