From 6066d284d17174e2038466a12c6b1874000be126 Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Mon, 20 May 2024 11:22:58 -0700 Subject: [PATCH] Tests for the new behavior of `transform-genbank-location` [#35] --- .../transform-genbank-location.t | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/transform-genbank-location/transform-genbank-location.t diff --git a/tests/transform-genbank-location/transform-genbank-location.t b/tests/transform-genbank-location/transform-genbank-location.t new file mode 100644 index 0000000..a835455 --- /dev/null +++ b/tests/transform-genbank-location/transform-genbank-location.t @@ -0,0 +1,30 @@ +Verify behavior of `transform-genbank-location` around prescence/abscence of +`database` and `location` fields. + +If `location` field is present, transform it. + + $ echo '{"database":"GenBank", "location": "USA:Oregon, Salem" }' \ + > | $TESTDIR/../../transform-genbank-location + {"database":"GenBank","location":"Salem","country":"USA","division":"Oregon"} + +If `database` field is absent, complain. + + $ echo '{"location": "USA:Oregon, Salem" }' \ + > | $TESTDIR/../../transform-genbank-location + Record must contain `database` field to use `transform-genbank-location.` + {"location":"USA:Oregon, Salem"} + +If `database` field has unsupported value, complain. + + $ echo '{"database": "unsupported", "location": "USA:Oregon, Salem" }' \ + > | $TESTDIR/../../transform-genbank-location + Database value of unsupported not supported for `transform-genbank-location`; must be "GenBank" or "RefSeq". + {"database":"unsupported","location":"USA:Oregon, Salem"} + + +If `location` field is absent, complain. + + $ echo '{"database": "GenBank" }' \ + > | $TESTDIR/../../transform-genbank-location + `transform-genbank-location` requires a `location` field; this record does not have one. + {"database":"GenBank"}