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 <