Implement edit command
This commit is contained in:
parent
d2405b8b3b
commit
416d837307
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
setup() {
|
||||
source ../zk
|
||||
}
|
||||
|
||||
test__zk_edit_uses_filename_when_passed_as_parameter() {
|
||||
# shellcheck disable=SC2016
|
||||
fake vi 'echo vi "${FAKE_PARAMS[@]}"'
|
||||
|
||||
export EDITOR=""
|
||||
zettel_name="11111111111111"
|
||||
expected="vi $ZKDIR/$zettel_name"
|
||||
|
||||
result="$(_zk_edit $zettel_name)"
|
||||
|
||||
assert_equals "$expected" "$result"
|
||||
}
|
||||
|
||||
test__zk_edit_uses__zk_search_when_filename_not_passed_as_parameter() {
|
||||
export EDITOR=""
|
||||
zettel_name="11111111111111"
|
||||
expected="vi $ZKDIR/$zettel_name"
|
||||
|
||||
# shellcheck disable=SC2016
|
||||
fake vi 'echo vi "${FAKE_PARAMS[@]}"'
|
||||
fake _zk_search echo "$zettel_name"
|
||||
|
||||
result="$(_zk_edit)"
|
||||
|
||||
assert_equals "$expected" "$result"
|
||||
}
|
Loading…
Reference in New Issue