The stdinBody.contains compare that is being done here, is misleading. If we want to capture the initialized method as per the spec, the string.contains will also glob notifications/initialized which can be problematic.
Ideas to circumvent the problem:
- Allow the use of regular expressions to capture the required fragment
- Introduce different properties to do a
string.equals instead of a string.contains
- Keep the behavior as is, but warn the users that the comparison is a contains and that edge cases such as above can produce incorrect results. Instead instruct users to pass a fragment of the JSON rather than a string that is contained in a property value of the json from the STDIN.
There may be other ways. Happy to brainstorm.