Skip to content

Commit

Permalink
test: add create-account query
Browse files Browse the repository at this point in the history
  • Loading branch information
vindard committed Jul 26, 2024
1 parent 4d6393f commit 4e89e96
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
26 changes: 26 additions & 0 deletions bats/add-interest-account.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bats

load "helpers"

setup_file() {
make reset-tf-state run-tf || true
}

@test "add-interest-account: can add account" {
interest_account_id=$(random_uuid)
variables=$(
jq -n \
--arg interest_account_id "$interest_account_id" \
'{
"interestAccountId": $interest_account_id,
"interestAccountName": ("Interest Income #" + $interest_account_id),
"interestAccountCode": ("INTEREST_INCOME." + $interest_account_id),
"interestRevenueControlAccountSetId": "00000000-0000-0000-0000-140000000001"
}'
)
exec_graphql 'add-interest-account' "$variables"
err_msg=$(graphql_output '.errors[0].message')
[[ -n "$err_msg" ]] || exit 1
[[ "$err_msg" != "null" ]] || exit 1
! [[ "$err_msg" =~ "duplicate key" ]] || exit 1
}
19 changes: 19 additions & 0 deletions bats/gql/add-interest-account.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
mutation CreateInterestAccount(
$interestAccountId: UUID!
$interestAccountCode: String!
$interestAccountName: String!
$interestRevenueControlAccountSetId: UUID!
) {
interest: accountCreate(
input: {
accountId: $interestAccountId
code: $interestAccountCode
name: $interestAccountName
accountSetIds: [$interestRevenueControlAccountSetId]
}
) {
account {
accountId
}
}
}

0 comments on commit 4e89e96

Please sign in to comment.