Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chasefleming committed Aug 1, 2023
1 parent 4fe6c41 commit 906845d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion internal/scripts/scripts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func Test_Execute(t *testing.T) {

t.Run("Fail parsing invalid JSON args", func(t *testing.T) {
inArgs := []string{tests.TestScriptSimple.Filename}
scriptFlags.ArgsJSON = "invalid"
flags.ArgsJSON = "invalid"

result, err := execute(inArgs, command.GlobalFlags{}, util.NoLogger, rw, srv.Mock)
assert.Nil(t, result)
Expand Down
26 changes: 13 additions & 13 deletions internal/transactions/transactions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ func Test_Send(t *testing.T) {

t.Run("Success", func(t *testing.T) {
const gas = uint64(1000)
sendFlags.GasLimit = gas
inArgs := []string{tests.TransactionArgString.Filename, "foo"}
flags.GasLimit = gas
inArgs := []string{tests.TransactionArgString.Filename}

srv.SendTransaction.Run(func(args mock.Arguments) {
roles := args.Get(1).(transactions.AccountRoles)
Expand All @@ -160,33 +160,33 @@ func Test_Send(t *testing.T) {
})

t.Run("Fail non-existing account", func(t *testing.T) {
sendFlags.Proposer = "invalid"
flags.Proposer = "invalid"
_, err := send([]string{""}, command.GlobalFlags{}, util.NoLogger, srv.Mock, state)
assert.EqualError(t, err, "proposer account: [invalid] doesn't exists in configuration")
sendFlags.Proposer = "" // reset
flags.Proposer = "" // reset

sendFlags.Payer = "invalid"
flags.Payer = "invalid"
_, err = send([]string{""}, command.GlobalFlags{}, util.NoLogger, srv.Mock, state)
assert.EqualError(t, err, "payer account: [invalid] doesn't exists in configuration")
sendFlags.Payer = "" // reset
flags.Payer = "" // reset

sendFlags.Authorizers = []string{"invalid"}
flags.Authorizers = []string{"invalid"}
_, err = send([]string{""}, command.GlobalFlags{}, util.NoLogger, srv.Mock, state)
assert.EqualError(t, err, "authorizer account: [invalid] doesn't exists in configuration")
sendFlags.Authorizers = nil // reset
flags.Authorizers = nil // reset

sendFlags.Signer = "invalid"
flags.Signer = "invalid"
_, err = send([]string{""}, command.GlobalFlags{}, util.NoLogger, srv.Mock, state)
assert.EqualError(t, err, "signer account: [invalid] doesn't exists in configuration")
sendFlags.Signer = "" // reset
flags.Signer = "" // reset
})

t.Run("Fail signer and payer flag", func(t *testing.T) {
sendFlags.Proposer = config.DefaultEmulator.ServiceAccount
sendFlags.Signer = config.DefaultEmulator.ServiceAccount
flags.Proposer = config.DefaultEmulator.ServiceAccount
flags.Signer = config.DefaultEmulator.ServiceAccount
_, err := send([]string{""}, command.GlobalFlags{}, util.NoLogger, srv.Mock, state)
assert.EqualError(t, err, "signer flag cannot be combined with payer/proposer/authorizer flags")
sendFlags.Signer = "" // reset
flags.Signer = "" // reset
})

t.Run("Fail loading transaction file", func(t *testing.T) {
Expand Down

0 comments on commit 906845d

Please sign in to comment.