Skip to content

Commit

Permalink
Add tests for post-command
Browse files Browse the repository at this point in the history
  • Loading branch information
DCsunset committed Jul 30, 2022
1 parent 2093aa9 commit 35b0ab2
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/test-config.bats
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,24 @@ notes="./notes"

assert_failure
assert_line "Could not create directory $NOTES_DIRECTORY/testfile, please update your \$NOTES_DIRECTORY"
}
}

@test "Post-command should run if it is a modification command" {
mkdir -p $HOME/.config/notes
echo 'POST_COMMAND="echo 1 > $HOME/post-output"' > $HOME/.config/notes/config
run $notes new test

assert_success
assert_exists $HOME/post-output
}

@test "Post-command should not run if it is not a modification command" {
run $notes new test

mkdir -p $HOME/.config/notes
echo 'POST_COMMAND="echo 1 > $HOME/post-output"' > $HOME/.config/notes/config
run $notes cat test

assert_success
refute_exists $HOME/post-output
}

0 comments on commit 35b0ab2

Please sign in to comment.