From 880df36ad54c10696844d43c1a2f27d71d714d85 Mon Sep 17 00:00:00 2001 From: Nikolay Eskov Date: Fri, 16 Aug 2024 09:08:43 +0300 Subject: [PATCH] Fixed with new 'TODO' test 'TestInternalPaymentsValidationFailure'. --- pkg/ride/tree_evaluation_test.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/ride/tree_evaluation_test.go b/pkg/ride/tree_evaluation_test.go index 67dd261b2..ba654218a 100644 --- a/pkg/ride/tree_evaluation_test.go +++ b/pkg/ride/tree_evaluation_test.go @@ -3972,9 +3972,17 @@ func TestInternalPaymentsValidationFailure(t *testing.T) { // Switch on internal payments validation and reset wrapped state env = env.withValidateInternalPayments().withWrappedState() res, err = CallFunction(env.toEnv(), tree1, proto.NewFunctionCall("call", proto.Arguments{})) - // Expecting validation error for the switched on internal payments validation + // TODO: is it correct to expect no error here? + // The actions application and payments check order has been changed. This change affects the test result. + // No error is expected in this case, because asset is transferred back and payments check happens after + require.NoError(t, err) + require.IsType(t, DAppResult{}, res) + + // Switch on payments fix and reset wrapped state + env = env.withPaymentsFix().withWrappedState() + res, err = CallFunction(env.toEnv(), tree1, proto.NewFunctionCall("call", proto.Arguments{})) require.Nil(t, res) - require.Error(t, err) + require.EqualError(t, err, "invoke: failed to apply attached payments: not enough money in the DApp, balance of asset 2fCdmsn6maErwtLuzxoUrCBkh2vx5SvXtMKAJtN4YBgd on address 3PH75p2rmMKCV2nyW4TsAdFgFtmc61mJaqA after payments application is -50: negative balance after payments application") //nolint:lll } func TestAliasesInInvokes(t *testing.T) {