https://www.nf-test.com/docs/assertions/files/#json-files
The example provided in these sections of the page for assessing individual keys could be a bit clearer imo.
assert path(process.out.out_ch.get(0)).json.key == "value"
It should be made a bit clearer that this command tests that a key named key has a value of "value", and NOT that the list of keys in the JSON has only one element that is "value".
From the original example I was expecting path(process.out.out_ch.get(0)).json.key to return something like [ "metadata", "metrics" ] for my JSON that looked like { "metadata" : [...], "metrics" : [...] }.
i.e. the current phrasing made it look to me like .key is like python's .keys().
Maybe the examples could be updated to something a bit more explicit like:
assert path(process.out.out_ch.get(0)).json.tool == "nf-test"
https://www.nf-test.com/docs/assertions/files/#json-files
The example provided in these sections of the page for assessing individual keys could be a bit clearer imo.
It should be made a bit clearer that this command tests that a key named
keyhas a value of"value", and NOT that the list of keys in the JSON has only one element that is"value".From the original example I was expecting
path(process.out.out_ch.get(0)).json.keyto return something like[ "metadata", "metrics" ]for my JSON that looked like{ "metadata" : [...], "metrics" : [...] }.i.e. the current phrasing made it look to me like
.keyis like python's.keys().Maybe the examples could be updated to something a bit more explicit like: