feat: skip subcommand
This commit is contained in:
parent
43ca9661b0
commit
1f34d0eeec
2 changed files with 103 additions and 0 deletions
|
|
@ -190,6 +190,44 @@ load test_helper
|
|||
[ "${status}" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "help skip shows skip usage" {
|
||||
run_nag help skip
|
||||
[ "${status}" -eq 0 ]
|
||||
[[ "${output}" =~ "Usage:" ]]
|
||||
[[ "${output}" =~ "skip <id>" ]]
|
||||
}
|
||||
|
||||
@test "skip reschedules a repeating alarm" {
|
||||
run_nag every day "tomorrow 3pm" daily task
|
||||
run_nag skip 1
|
||||
[ "${status}" -eq 0 ]
|
||||
[[ "${output}" =~ "Skipped" ]]
|
||||
[ -s "${NAG_DIR}/alarms" ]
|
||||
local _ts _now
|
||||
_ts="$(cut -f2 "${NAG_DIR}/alarms")"
|
||||
_now="$(date +%s)"
|
||||
(( _ts > _now ))
|
||||
}
|
||||
|
||||
@test "skip deletes a one-shot alarm" {
|
||||
run_nag at "tomorrow 3pm" "one-shot"
|
||||
run_nag skip 1
|
||||
[ "${status}" -eq 0 ]
|
||||
[[ "${output}" =~ "Stopped" ]]
|
||||
run_nag
|
||||
[[ "${output}" =~ "Nothing to nag about" ]]
|
||||
}
|
||||
|
||||
@test "skip with nonexistent ID fails" {
|
||||
run_nag skip 99
|
||||
[ "${status}" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "skip without ID fails" {
|
||||
run_nag skip
|
||||
[ "${status}" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "help every shows every usage" {
|
||||
run_nag help every
|
||||
[ "${status}" -eq 0 ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue