no submod
This commit is contained in:
66
work/notea/crawler/notes_test.sh
Normal file
66
work/notea/crawler/notes_test.sh
Normal file
@@ -0,0 +1,66 @@
|
||||
#! /bin/bash
|
||||
|
||||
test_ids() {
|
||||
local two_levels='{
|
||||
"Branches": {
|
||||
"id": {
|
||||
"Branches": {
|
||||
"subid": {
|
||||
"Branches": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}'
|
||||
notes eval "$(cat <<EOF
|
||||
_tree() { echo '$two_levels'; true; }
|
||||
(ids; true) | grep '^id$' > /dev/null || return 101
|
||||
(ids; true) | grep '^id\/subid$' > /dev/null || return 102
|
||||
ids | wc -l | grep 2 > /dev/null || return 103
|
||||
EOF
|
||||
)"
|
||||
}
|
||||
|
||||
test_meta() {
|
||||
local two_levels='{
|
||||
"Branches": {
|
||||
"id": {
|
||||
"Leaf": {"Title": "top level"},
|
||||
"Branches": {
|
||||
"subid": {
|
||||
"Leaf": {"Title": "sub level"},
|
||||
"Branches": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}'
|
||||
notes eval "$(cat <<EOF
|
||||
_tree() { echo '$two_levels'; }
|
||||
meta id | jq .Title | grep -q top.level || return 201
|
||||
meta id/subid | jq .Title | grep -q sub.level || return 202
|
||||
EOF
|
||||
)"
|
||||
}
|
||||
|
||||
test__is_deleted() {
|
||||
local two_levels='{
|
||||
"Branches": {
|
||||
"id": {
|
||||
"Leaf": {"Title": "top level", "Deleted": true},
|
||||
"Branches": {
|
||||
"subid": {
|
||||
"Leaf": {"Title": "sub level"},
|
||||
"Branches": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}'
|
||||
notes eval "$(cat <<EOF
|
||||
_tree() { echo '$two_levels'; }
|
||||
_is_deleted id || return 301
|
||||
_is_deleted id/subid || return 302
|
||||
EOF
|
||||
)"
|
||||
}
|
||||
Reference in New Issue
Block a user