diff options
| author | Christopher Warner <cwarner@kernelcode.com> | 2026-10-10 18:49:01 -0400 |
|---|---|---|
| committer | Christopher Warner <cwarner@kernelcode.com> | 2026-10-10 18:49:01 -0400 |
| commit | be0d09e2cb91ef391d7455334fc5ed15d6f5649a (patch) | |
| tree | bc3b8d3c3b79de695761b750789aeb2ddaf8df49 /tests | |
| parent | b5e522306f3f4153f633618b8d1e36dc8bbf6371 (diff) | |
| download | iphone-notes-be0d09e2cb91ef391d7455334fc5ed15d6f5649a.tar.gz iphone-notes-be0d09e2cb91ef391d7455334fc5ed15d6f5649a.tar.bz2 iphone-notes-be0d09e2cb91ef391d7455334fc5ed15d6f5649a.tar.xz iphone-notes-be0d09e2cb91ef391d7455334fc5ed15d6f5649a.zip | |
feat: update existing Apple Notes by title instead of duplicating
Add `icloud-note update` that finds a note by title and replaces its
content in place so revision requests do not create a second note.
Co-authored-by: Cursor <cursoragent@cursor.com>
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/cli.test.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/cli.test.sh b/tests/cli.test.sh index 6aeef87..083f73a 100755 --- a/tests/cli.test.sh +++ b/tests/cli.test.sh @@ -17,6 +17,7 @@ pass() { echo "ok: $*"; } # --- help --- out="$("${CLI[@]}" 2>&1)" || fail "no-args help failed" [[ "$out" == *"icloud-note create"* ]] || fail "help missing create: $out" +[[ "$out" == *"icloud-note update"* ]] || fail "help missing update: $out" [[ "$out" == *"headless"* ]] || fail "help should say create/status are headless" [[ "$out" != *"--headed"* ]] || fail "help must not advertise --headed" [[ "$out" == *"$ICLOUD_NOTES_CONFIG"* ]] || fail "help should show ICLOUD_NOTES_CONFIG path" @@ -66,6 +67,27 @@ out="$("${CLI[@]}" create "Positional" --body "x" 2>&1)" || fail "positional cre [[ "$out" == *'title="Positional"'* ]] || fail "positional title: $out" pass "create positional title" +# --- update validation / dry-run --- +set +e +err="$("${CLI[@]}" update --body "x" 2>&1)" +code=$? +set -e +[[ "$code" -ne 0 ]] || fail "update without title should fail" +[[ "$err" == *"Provide --title"* ]] || fail "update empty title message: $err" +pass "update requires title" + +out="$("${CLI[@]}" update --title "Existing" --body "revised" 2>&1)" \ + || fail "update dry-run failed" +[[ "$out" == *'dry-run: would update note match="Existing"'* ]] || fail "update dry-run: $out" +[[ "$out" == *'title="Existing"'* ]] || fail "update dry-run title: $out" +pass "update dry-run" + +out="$("${CLI[@]}" update --match-title "Old" --title "New" --body "x" 2>&1)" \ + || fail "update match-title dry-run failed" +[[ "$out" == *'match="Old"'* ]] || fail "match-title: $out" +[[ "$out" == *'title="New"'* ]] || fail "new title in update dry-run: $out" +pass "update --match-title dry-run" + # --- status dry-run without session --- set +e err="$("${CLI[@]}" status 2>&1)" |
