I want to unit test my javascripts which mainly are 5-10 liners without any function written. I need help with some github codes where testing has been done without any method in JS files.
Also, I need help in fetching variables inside test.js from my source JS files to assert them inside test.js
Please do not comment if you don't have an answer.
Answer by Dino-at-Google
·
Jan 23, 2019 at 05:43 PM
hmmm, I suggest that you refactor your JS code to wrap capability into functions, that can then be properly tested.
Also, this seems to be a question totally unrelated to Apigee Edge.
Please stick to the question asked.
Also, why do you think it is unrelated to apigee edge? Don't we use javascripts in APIGEE?
Don't unnecessarily answer for the sake of answering. You aren't helping
Answer by Esteban Solano · Oct 10, 2019 at 08:52 PM
Here's an example of how to do it. Check my answer there. I attached an image that shows how to get, set and assert variables.
https://community.apigee.com/answers/76423/view.html
I hope this helps.