diff --git a/README.md b/README.md index e9f1b4d..acfa697 100644 --- a/README.md +++ b/README.md @@ -264,6 +264,10 @@ If you are contributing to ops, debugging, or want to try out bleeding edge feat This means your global ops script will point directly to the repo and you can make live changes. + # run tests with bats + # https://github.com/sstephenson/bats + bats test + ## License MIT License diff --git a/test/main.bats b/test/main.bats new file mode 100644 index 0000000..bcf0957 --- /dev/null +++ b/test/main.bats @@ -0,0 +1,26 @@ +#!/usr/bin/env bats + + +@test "valid syntax" { + bash -n ops.sh +} + +@test "valid version" { + [[ "$(bash ops.sh version)" =~ "ops version " ]] +} + +@test "valid help" { + [[ "$(bash ops.sh help)" =~ "Usage: ops " ]] +} + +@test "services successfully started" { + bash ops.sh start + + [[ -z "$(bash ops.sh ps | grep Exit)" ]] +} + +@test "services successfully stopped" { + bash ops.sh stop + + [[ -z "$(bash ops.sh ps | grep Up)" ]] +}