Skip to content

Commit

Permalink
Add initial tests for specific logic of git-elegant.bash
Browse files Browse the repository at this point in the history
The tests handle unknown and non-provided commands. They allow making
some refactoring of git-elegant.bash.

In general, the tests for git-elegant.bash have to cover a logic of
invocation of other commands or some corner cases.

#118
  • Loading branch information
extsoft committed Sep 10, 2019
1 parent adc329b commit c20aa82
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/git-elegant.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bats

load addons-common

@test "'git elegant': a help is displayed if a command is not provided" {
check git-elegant
[[ "$status" -eq 0 ]]
[ ${#lines[@]} -gt 3 ]
}

@test "'git elegant': a unknown command is handled in user-friendly way" {
check git-elegant sdfsdfsd
[[ "$status" -eq 46 ]]
[[ "${lines[@]}" =~ "Unknown command: git elegant sdfsdfsd" ]]
}

0 comments on commit c20aa82

Please sign in to comment.