Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Unit testing of JavaScript Policy

Is there a way to unit test the variables in JavaScript code.

I don't know how to mock response.content.asXML etc work from within a unit test. Is there a way to mock these variables.

I have been able to mock context.getVariable() and context.setVariable using mocha framework

Solved Solved
0 4 1,609
1 ACCEPTED SOLUTION

I would use a separate file with mock response and pass it to the mocha script to validate against some tests. Would that work ?

View solution in original post

4 REPLIES 4