diff --git a/test/bats/contract/accounts.bats b/test/bats/contract/accounts.bats new file mode 100644 index 000000000..145edf08e --- /dev/null +++ b/test/bats/contract/accounts.bats @@ -0,0 +1,22 @@ +#!/usr/bin/env bats + +load '../node_modules/bats-support/load' +load '../node_modules/bats-assert/load' + +# list-accounts should return the account from env +@test "list accounts" { + run ${EXE} list-accounts + assert_success + assert_output --partial "Nickname: \"env\"" + assert_output --partial "Configured via: CONNECT_SERVER environment variable" + assert_output --partial "Authentication: Connect API key" +} + +# test-account should pass with env +@test "test accounts" { + run ${EXE} test-account env + assert_success + assert_output --partial "Name: Administrator Smith" + assert_output --partial "Username: admin" + assert_output --partial "Email: rsc@example.com" +} \ No newline at end of file diff --git a/test/bats/justfile b/test/bats/justfile index 2edd8b0c4..f6107e867 100644 --- a/test/bats/justfile +++ b/test/bats/justfile @@ -2,6 +2,8 @@ alias c := clean alias i := install alias t := test +export CONTENT := env_var_or_default("CONTENT", "all") + _ci := env_var_or_default("CI", "false") _debug := env_var_or_default("DEBUG", "false") @@ -49,7 +51,7 @@ run *args: # Executes bats deploy tests test-contract: #!/usr/bin/env bash - set -exo pipefail + set -eou pipefail {{ _with_debug }} exe=$(just ../../executable-path) @@ -61,16 +63,16 @@ test-contract: pip install -r ../setup/requirements.txt export CONNECT_SERVER="$(python ../setup/connect_setup.py)" export CONNECT_API_KEY="$(python ../setup/gen_apikey.py 'admin')" - if [[ -z "${CONTENT}" ]]; then + EXE=$exe npm run accounts + if [[ ${CONTENT}="all" ]]; then content_list=$(python ../deploy_helper.py) - echo "contents: ${content_list}" for content in ${content_list} do export CONTENT=${content} - EXE=$exe npm run contract + EXE=$exe npm run deploy done else - EXE=$exe npm run contract + EXE=$exe npm run deploy fi diff --git a/test/bats/package.json b/test/bats/package.json index 76698daf2..124eccfa8 100644 --- a/test/bats/package.json +++ b/test/bats/package.json @@ -1,7 +1,8 @@ { "private": true, "scripts": { - "contract": "bats -r -T -t ./contract", + "deploy": "bats -r -T -t ./contract/deploy.bats", + "accounts": "bats -r -T -t ./contract/accounts.bats", "cli": "bats -r -T -t ./cli" }, "devDependencies": {