Javascript unit test using mocha - Mock properties object

jivanpatil
Participant III

We are writing test cases using mocha. I am referring to this . Our test cases are around jsc resource that we have. Apigee javascript have context.getVariable(properties.myproperty). How I mock/pass properties.myproperty ? I am getting ReferenceError properties not defined. I am not good with javascript.

0 1 713
1 REPLY 1

Try adding the following to your tests:

    global.properties = {
      source: 'jwt.Decode-IAM-JWT.decoded.header.kid'
    }; 

That is what I do and it works fine.