From 3b0f1bc02ef047ad3eaf55be3f44e4a7acb6c54e Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Tue, 1 Feb 2022 09:32:58 -0700 Subject: [PATCH] test notea --- app/crawler/notea.sh | 3 +- app/crawler/notea_test.sh | 59 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 app/crawler/notea_test.sh diff --git a/app/crawler/notea.sh b/app/crawler/notea.sh index a91d969..33c77e6 100644 --- a/app/crawler/notea.sh +++ b/app/crawler/notea.sh @@ -7,8 +7,7 @@ notea() ( ids() { ncurl $NOTEA_ADDR/api/tree \ - | jq -r '.items \ - | to_entries[].value.id' \ + | jq -r '.items | to_entries[].value.id' \ | grep -v '^root$' } diff --git a/app/crawler/notea_test.sh b/app/crawler/notea_test.sh new file mode 100644 index 0000000..5074f58 --- /dev/null +++ b/app/crawler/notea_test.sh @@ -0,0 +1,59 @@ +#! /bin/bash + +main() { + for t in $(grep ^test_* ./notea_test.sh | sed 's/(.*//'); do + each + echo run $t >&2 + if ! eval "$t"; then + echo failed $t >&2 + fi + done +} + +each() { + export CACHE=$(mktemp -d) + source ./notea.sh + source ./cache.sh +} + +test_ids() { + notea eval "$(cat <