Test Isjson in MXUnit
Asked Answered
G

1

6

I am working on the MxUnit test frame work for CFML. In it, I want to check whether the return value of a function is a valid JSON or not. Currently I am using:

assertEquals(True,IsJSON(userEventItems),'The return must be json');

Is there any MXUnit function to check the assert is a JSON or not, like assertIsQuery() in MXUnit?

Gismo answered 8/7, 2014 at 14:18 Comment(0)
P
5

According to the MXUnit built-in assertions page there is not a function. Your best bet is to test the function the way you are or by using the assertTrue() function

assertTrue(isJSON(userEventItems), 'The return must be json');
Pedantry answered 8/7, 2014 at 14:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.