mirror of
https://github.com/alexanderepstein/Bash-Snippets
synced 2018-11-08 02:59:35 +01:00
Adding tests for todo
This commit is contained in:
parent
8886781101
commit
8f813d7e38
59
tests/todo.bats
Executable file
59
tests/todo.bats
Executable file
@ -0,0 +1,59 @@
|
||||
#!/bin/env bats
|
||||
|
||||
@test "Testing todo tool" {
|
||||
echo todo
|
||||
}
|
||||
|
||||
@test "Check for latest version of bash-snippets on update" {
|
||||
run todo update
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "Bash-Snippets is already the latest version" ]
|
||||
}
|
||||
|
||||
|
||||
@test "No arguments prints usage instructions" {
|
||||
run todo
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${lines[0]}" = "Todo" ]
|
||||
}
|
||||
|
||||
@test "The -h option should print usage" {
|
||||
run todo -h
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${lines[0]}" = "Todo" ]
|
||||
}
|
||||
|
||||
@test "Adding task" {
|
||||
run todo -a First task ever
|
||||
[ "$status" -eq 0 ]
|
||||
result=$( echo $(todo -g) | grep -Eo "01). First task ever" )
|
||||
[ "$result" = "01). First task ever" ]
|
||||
}
|
||||
|
||||
@test "Getting task" {
|
||||
run todo -g
|
||||
[ "$status" -eq 0 ]
|
||||
result=$( echo $(todo -g) | grep -Eo "01). First task ever" )
|
||||
[ "$result" = "01). First task ever" ]
|
||||
}
|
||||
|
||||
@test "Removing task" {
|
||||
run todo -r "1"
|
||||
[ "$status" -eq 0 ]
|
||||
result=$( cat ~/.todo/list.txt )
|
||||
echo $result
|
||||
[ "$result" = "" ]
|
||||
}
|
||||
|
||||
@test "Getting from empty task list" {
|
||||
run todo -g
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "No tasks found" ]
|
||||
}
|
||||
|
||||
@test "Get the tools version with -v" {
|
||||
run todo -v
|
||||
[ "$status" -eq 0 ]
|
||||
result=$( echo $(todo -v) | grep -Eo "Version")
|
||||
[ "$result" = "Version" ]
|
||||
}
|
Loading…
Reference in New Issue
Block a user