Skip to content

Commit

Permalink
remove dependency on ROOT_DIRECTORY in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
georglauterbach committed Feb 24, 2024
1 parent 11fa65d commit e0832d3
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 16 deletions.
2 changes: 0 additions & 2 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ set dotenv-load := false

export ROOT_DIRECTORY := justfile_directory()



# show this help
@_default:
just --list
Expand Down
13 changes: 6 additions & 7 deletions tests/10-sourcing.bats
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ load 'bats_assert/load'
BATS_TEST_NAME_PREFIX='10-sourcing :: '

function setup_file() {
cd "${ROOT_DIRECTORY}" || exit 1
LOG_LEVEL='info'
export LOG_LEVEL='info'
}

@test "sourcing succeeds from repository root" {
Expand All @@ -17,7 +16,7 @@ function setup_file() {

@test "sourcing succeeds from 'tests/' directory" {
(
cd "${ROOT_DIRECTORY}/tests/"
cd "tests/"
# shellcheck source=load
run bash -c 'source ../load'
assert_success
Expand All @@ -26,7 +25,7 @@ function setup_file() {

@test "sourcing succeeds from 'modules/' directory" {
(
cd "${ROOT_DIRECTORY}/modules/" || exit 1
cd "modules/" || exit 1
# shellcheck source=load
run bash -c ' source ../load'
assert_success
Expand All @@ -40,23 +39,23 @@ function setup_file() {

@test "sourcing with parameters succeeds from 'tests/' directory" {
(
cd "${ROOT_DIRECTORY}/tests/" || exit 1
cd "tests/" || exit 1
run source ../load 'log' 'cri'
assert_success
)
}

@test "sourcing with parameters succeeds from 'modules/' directory" {
(
cd "${ROOT_DIRECTORY}/modules/"
cd "modules/"
run source ../load 'log' 'cri'
assert_success
)
}

@test "sourcing with parameters succeeds from '.github/workflows' directory" {
(
cd "${ROOT_DIRECTORY}/.github/workflows/"
cd ".github/workflows/"
run source ../../load 'log' 'cri'
assert_success
)
Expand Down
1 change: 0 additions & 1 deletion tests/20-log.bats
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ load 'bats_assert/load'
BATS_TEST_NAME_PREFIX='20-log :: '

function setup_file() {
cd "${ROOT_DIRECTORY}" || exit 1
export LOG_LEVEL='trace'
export TEST_STRING='jfk FJHAE aea728 djKJ k/('
}
Expand Down
1 change: 0 additions & 1 deletion tests/30-errors.bats
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ load 'bats_assert/load'
BATS_TEST_NAME_PREFIX='30-errors :: '

function setup_file() {
cd "${ROOT_DIRECTORY}" || exit 1
export LOG_LEVEL='trace'
}

Expand Down
1 change: 0 additions & 1 deletion tests/40-utils.bats
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ load 'bats_assert/load'
BATS_TEST_NAME_PREFIX='40-utils :: '

function setup_file() {
cd "${ROOT_DIRECTORY}" || exit 1
export LOG_LEVEL='trace'
}

Expand Down
4 changes: 0 additions & 4 deletions tests/90-generic.bats
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ load 'bats_assert/load'

BATS_TEST_NAME_PREFIX='90-generic :: '

function setup_file() {
cd "${ROOT_DIRECTORY}" || exit 1
}

@test "'cri.sh' makes the correct decision" {
source load 'log' 'cri'

Expand Down

0 comments on commit e0832d3

Please sign in to comment.