Skip to content

Commit

Permalink
separate test types
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Gartland committed Jan 16, 2024
1 parent 7ae3026 commit d5878c3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
22 changes: 22 additions & 0 deletions test/bats/contract/accounts.bats
Original file line number Diff line number Diff line change
@@ -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: [email protected]"
}
12 changes: 7 additions & 5 deletions test/bats/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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


Expand Down
3 changes: 2 additions & 1 deletion test/bats/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit d5878c3

Please sign in to comment.