test: splits monolith into a bats file for each subcommand
This commit is contained in:
parent
b6fde582bb
commit
2a3c9f264f
10 changed files with 535 additions and 458 deletions
34
test/skip.bats
Normal file
34
test/skip.bats
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
@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 ]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue