Skip to content

Commit

Permalink
Fix 'TestInvokePaymentsCheckBeforeAndAfterInvoke'.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickeskov committed Aug 16, 2024
1 parent 04c3f4e commit c59776f
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions pkg/ride/tree_evaluation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5329,7 +5329,7 @@ func TestRegularAvailableBalanceSwitchOnV5ToV6(t *testing.T) {
require.EqualError(t, err, "invoke: failed to apply attached payments: not enough money in the DApp, balance of asset WAVES on address 3MzDtgL5yw73C2xVLnLJCrT5gCL4357a4sz after payments application is -1000000000: negative balance after payments application") //nolint:lll
}

func TestInvokePaymentsCheckBeforeAndAfterInvokeScriptTxActivation(t *testing.T) {
func TestInvokePaymentsCheckBeforeAndAfterInvoke(t *testing.T) {
dApp1 := newTestAccount(t, "DAPP1") // 3MzDtgL5yw73C2xVLnLJCrT5gCL4357a4sz
dApp2 := newTestAccount(t, "DAPP2") // 3N7Te7NXtGVoQqFqktwrFhQWAkc6J8vfPQ1
sender := newTestAccount(t, "SENDER") // 3N8CkZAyS4XcDoJTJoKNuNk2xmNKmQj7myW
Expand Down Expand Up @@ -5370,17 +5370,29 @@ func TestInvokePaymentsCheckBeforeAndAfterInvokeScriptTxActivation(t *testing.T)
withWrappedState()
}

t.Run("BeforeInvokeScriptActivation", func(t *testing.T) {
t.Run("BeforeLightNodeActivationAndPaymentsFix", func(t *testing.T) {
env := prepareEnv().withWrappedState()
res, err := CallFunction(env.toEnv(), tree1, proto.NewFunctionCall("call", proto.Arguments{}))
assert.Nil(t, res)
assert.EqualError(t, err, "gotcha")
})
t.Run("AfterInvokeScriptActivation", func(t *testing.T) {
t.Run("AfterLightNodeActivation", func(t *testing.T) {
env := prepareEnv().withLightNodeActivated()
res, err := CallFunction(env.toEnv(), tree1, proto.NewFunctionCall("call", proto.Arguments{}))
assert.Nil(t, res)
assert.EqualError(t, err, "invoke: failed to apply attached payments: not enough money in the DApp, balance of asset WAVES on address 3MzDtgL5yw73C2xVLnLJCrT5gCL4357a4sz after payments application is -4900000000")
assert.EqualError(t, err, "gotcha")
})
t.Run("WithPaymentsFix", func(t *testing.T) {
env := prepareEnv().withPaymentsFix()
res, err := CallFunction(env.toEnv(), tree1, proto.NewFunctionCall("call", proto.Arguments{}))
assert.Nil(t, res)
assert.EqualError(t, err, "invoke: failed to apply attached payments: not enough money in the DApp, balance of asset WAVES on address 3MzDtgL5yw73C2xVLnLJCrT5gCL4357a4sz after payments application is -4900000000: negative balance after payments application") //nolint:lll
})
t.Run("AfterLightNodeActivationWithPaymentsFix", func(t *testing.T) {
env := prepareEnv().withPaymentsFix().withPaymentsFix()
res, err := CallFunction(env.toEnv(), tree1, proto.NewFunctionCall("call", proto.Arguments{}))
assert.Nil(t, res)
assert.EqualError(t, err, "invoke: failed to apply attached payments: not enough money in the DApp, balance of asset WAVES on address 3MzDtgL5yw73C2xVLnLJCrT5gCL4357a4sz after payments application is -4900000000: negative balance after payments application") //nolint:lll
})
}

Expand Down

0 comments on commit c59776f

Please sign in to comment.