Converting saved global variable to string in test script

Hello, I want to assert dynamic user hash number in respond body in login api request. I created global variable of the dynamic user hash number and I have problem with assertion. I think it is because in console the number is a string and my global variable is not.

My question is, is it possible to convert a saved global variable to string to successfully assert with
body respond?



Screenshot_3

First thing is to work out what the variable actually is.

console.log(typeof("{{userHash}}"));

Once you know what it is, Postman is using JavaScript under the hood, so you just search on how to convert it to a string. Probably using toString().

However, I don’t really get your test. jsonObject is coming from the responseBody.
You then set a global variable using the info from jsonObject.

You then assert on the two. I don’t really get this test, as it will always be true.
How will you make the test fail, as you should do for all tests?