Skip to content

Commit 35b0ab2

Browse files
committed
Add tests for post-command
1 parent 2093aa9 commit 35b0ab2

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

test/test-config.bats

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,24 @@ notes="./notes"
5757

5858
assert_failure
5959
assert_line "Could not create directory $NOTES_DIRECTORY/testfile, please update your \$NOTES_DIRECTORY"
60-
}
60+
}
61+
62+
@test "Post-command should run if it is a modification command" {
63+
mkdir -p $HOME/.config/notes
64+
echo 'POST_COMMAND="echo 1 > $HOME/post-output"' > $HOME/.config/notes/config
65+
run $notes new test
66+
67+
assert_success
68+
assert_exists $HOME/post-output
69+
}
70+
71+
@test "Post-command should not run if it is not a modification command" {
72+
run $notes new test
73+
74+
mkdir -p $HOME/.config/notes
75+
echo 'POST_COMMAND="echo 1 > $HOME/post-output"' > $HOME/.config/notes/config
76+
run $notes cat test
77+
78+
assert_success
79+
refute_exists $HOME/post-output
80+
}

0 commit comments

Comments
 (0)