From 1d27a889085336c019fb4b532d9760724fe7ddb6 Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Tue, 15 Oct 2024 16:30:29 +0300 Subject: [PATCH] add test on validate amount --- internal/handlers/ussd/menuhandler_test.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/internal/handlers/ussd/menuhandler_test.go b/internal/handlers/ussd/menuhandler_test.go index 82cca01..0bde51a 100644 --- a/internal/handlers/ussd/menuhandler_test.go +++ b/internal/handlers/ussd/menuhandler_test.go @@ -1468,6 +1468,7 @@ func TestValidateAmount(t *testing.T) { t.Logf(err.Error()) } flag_invalid_amount, _ := fm.parser.GetFlag("flag_invalid_amount") + flag_api_error, _ := fm.GetFlag("flag_api_call_error") mockDataStore := new(mocks.MockUserDataStore) mockCreateAccountService := new(mocks.MockAccountService) @@ -1502,7 +1503,8 @@ func TestValidateAmount(t *testing.T) { }, publicKey: []byte("0xrqeqrequuq"), expectedResult: resource.Result{ - Content: "0.001", + Content: "0.001", + FlagReset: []uint32{flag_api_error}, }, }, { @@ -1520,8 +1522,9 @@ func TestValidateAmount(t *testing.T) { }, publicKey: []byte("0xrqeqrequuq"), expectedResult: resource.Result{ - FlagSet: []uint32{flag_invalid_amount}, - Content: "0.02", + FlagSet: []uint32{flag_invalid_amount}, + FlagReset: []uint32{flag_api_error}, + Content: "0.02", }, }, { @@ -1539,8 +1542,9 @@ func TestValidateAmount(t *testing.T) { }, publicKey: []byte("0xrqeqrequuq"), expectedResult: resource.Result{ - FlagSet: []uint32{flag_invalid_amount}, - Content: "0.02ms", + FlagSet: []uint32{flag_invalid_amount}, + FlagReset: []uint32{flag_api_error}, + Content: "0.02ms", }, }, }