From 3e74c1d939f82fd58b3dbad2ed9245a634d8dc72 Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Tue, 1 Oct 2024 13:26:47 +0300 Subject: [PATCH] test with all invalid inputs --- menu_traversal_test.go | 4 ++-- test_data.json | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/menu_traversal_test.go b/menu_traversal_test.go index 7513436..42a5d13 100644 --- a/menu_traversal_test.go +++ b/menu_traversal_test.go @@ -138,13 +138,13 @@ func TestAccountRegistrationInvalidPin(t *testing.T) { } } -func TestSendWithInvalidRecipient(t *testing.T) { +func TestSendWithInvalidInputs(t *testing.T) { en, fn := enginetest.TestEngine("session1234112") defer fn() ctx := context.Background() sessions := testData for _, session := range sessions { - groups := driver.FilterGroupsByName(session.Groups, "send_with_invalid_recipient") + groups := driver.FilterGroupsByName(session.Groups, "send_with_invalid_inputs") for _, group := range groups { for _, step := range group.Steps { cont, err := en.Exec(ctx, []byte(step.Input)) diff --git a/test_data.json b/test_data.json index 60a7a97..f9e3084 100644 --- a/test_data.json +++ b/test_data.json @@ -97,7 +97,7 @@ ] }, { - "name": "send_with_invalid_recipient", + "name": "send_with_invalid_inputs", "steps": [ { "input": "", @@ -119,10 +119,26 @@ "input": "065656", "expectedContent": "Maximum amount: 0.003 CELO\nEnter amount:\n0:Back" }, + { + "input": "0.1", + "expectedContent": "Amount 0.1 is invalid, please try again:\n1:retry\n9:Quit" + }, + { + "input": "1", + "expectedContent": "Maximum amount: 0.003 CELO\nEnter amount:\n0:Back" + }, { "input": "0.001", "expectedContent": "065656 will receive 0.001 from 0xd6CF3C87b0D4aD5978448bBbD6Db9EC6D74D624b\nPlease enter your PIN to confirm:\n0:Back\n9:Quit" }, + { + "input": "1222", + "expectedContent": "Incorrect pin\n1:retry\n9:Quit" + }, + { + "input": "1", + "expectedContent": "065656 will receive 0.001 from 0xd6CF3C87b0D4aD5978448bBbD6Db9EC6D74D624b\nPlease enter your PIN to confirm:\n0:Back\n9:Quit" + }, { "input": "1234", "expectedContent": "Your request has been sent. 065656 will receive 0.001 from 0xd6CF3C87b0D4aD5978448bBbD6Db9EC6D74D624b."