feat: stop subcommand, and disables empty lines from counting as an alarm element
This commit is contained in:
parent
c11aefb963
commit
6a13649c54
2 changed files with 107 additions and 3 deletions
|
|
@ -100,6 +100,52 @@ load test_helper
|
|||
[[ "${output}" =~ "[1] Tomorrow, 3pm — take a break" ]]
|
||||
}
|
||||
|
||||
@test "list shows empty message after stopping all alarms" {
|
||||
run_nag at "tomorrow 3pm" "test alarm"
|
||||
run_nag stop 1
|
||||
[ "${status}" -eq 0 ]
|
||||
run_nag
|
||||
[[ "${output}" =~ "Nothing to nag about" ]]
|
||||
}
|
||||
|
||||
@test "help stop shows stop usage" {
|
||||
run_nag help stop
|
||||
[ "${status}" -eq 0 ]
|
||||
[[ "${output}" =~ "Usage:" ]]
|
||||
[[ "${output}" =~ "stop <id>" ]]
|
||||
}
|
||||
|
||||
@test "stop removes an alarm by ID" {
|
||||
run_nag at "tomorrow 3pm" "take a break"
|
||||
run_nag stop 1
|
||||
[ "${status}" -eq 0 ]
|
||||
[[ "${output}" =~ "Stopped alarm 1" ]]
|
||||
run_nag
|
||||
[[ "${output}" =~ "Nothing to nag about" ]]
|
||||
}
|
||||
|
||||
@test "stop removes only the targeted alarm" {
|
||||
run_nag at "tomorrow 3pm" "first"
|
||||
run_nag at "tomorrow 4pm" "second"
|
||||
run_nag at "tomorrow 5pm" "third"
|
||||
run_nag stop 2
|
||||
[ "${status}" -eq 0 ]
|
||||
run_nag
|
||||
[[ "${output}" =~ "first" ]]
|
||||
[[ ! "${output}" =~ "second" ]]
|
||||
[[ "${output}" =~ "third" ]]
|
||||
}
|
||||
|
||||
@test "stop with nonexistent ID fails" {
|
||||
run_nag stop 99
|
||||
[ "${status}" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "stop without ID fails" {
|
||||
run_nag stop
|
||||
[ "${status}" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "list sorts alarms by time" {
|
||||
run_nag at "tomorrow 3pm" "take a break"
|
||||
run_nag at "tomorrow 9am" "standup"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue