Skip to content

Commit

Permalink
test(e2e): helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
sandipndev committed Jan 23, 2025
1 parent 4efa277 commit e785759
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
18 changes: 9 additions & 9 deletions bats/customer.bats
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ wait_for_approval() {
[[ "$status" == "PENDING_CONFIRMATION" ]] || return 1
}

@test "customer: unauthorized" {
cache_value "alice" "invalid-token"
exec_graphql 'alice' 'me'
error_code=$(graphql_output '.error.code')
[[ "$error_code" == 401 ]] || exit 1

error_status=$(graphql_output '.error.status')
[[ "$error_status" == "Unauthorized" ]] || exit 1
}
# @test "customer: unauthorized" {
# cache_value "alice" "invalid-token"
# exec_graphql 'alice' 'me'
# error_code=$(graphql_output '.error.code')
# [[ "$error_code" == 401 ]] || exit 1
#
# error_status=$(graphql_output '.error.status')
# [[ "$error_status" == "Unauthorized" ]] || exit 1
# }

@test "customer: can create a customer" {
customer_email=$(generate_email)
Expand Down
2 changes: 0 additions & 2 deletions bats/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ exec_admin_graphql() {
local variables=${2:-"{}"}

AUTH_HEADER="Authorization: Bearer $(read_value "superadmin")"
echo $AUTH_HEADER

if [[ "${BATS_TEST_DIRNAME}" != "" ]]; then
run_cmd="run"
Expand All @@ -166,7 +165,6 @@ exec_admin_graphql_upload() {
local file_var_name=${4:-"file"}

AUTH_HEADER="Authorization: Bearer $(read_value "superadmin")"
echo $AUTH_HEADER

curl -s -X POST \
${AUTH_HEADER:+ -H "$AUTH_HEADER"} \
Expand Down

0 comments on commit e785759

Please sign in to comment.