forked from urdt/ussd
polish code
This commit is contained in:
parent
0547bc7e5f
commit
f37ec13c75
@ -48,7 +48,7 @@ func extractBalance(response []byte) string {
|
|||||||
// Regex to match "Balance: <amount> <symbol>" followed by a newline
|
// Regex to match "Balance: <amount> <symbol>" followed by a newline
|
||||||
re := regexp.MustCompile(`(?m)^Balance:\s+(\d+(\.\d+)?)\s+([A-Z]+)`)
|
re := regexp.MustCompile(`(?m)^Balance:\s+(\d+(\.\d+)?)\s+([A-Z]+)`)
|
||||||
match := re.FindSubmatch(response)
|
match := re.FindSubmatch(response)
|
||||||
if match != nil && len(match) > 0 {
|
if match != nil {
|
||||||
return string(match[1]) + " " + string(match[3]) // "<amount> <symbol>"
|
return string(match[1]) + " " + string(match[3]) // "<amount> <symbol>"
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
@ -59,7 +59,7 @@ func extractMaxAmount(response []byte) string {
|
|||||||
// Regex to match "Maximum amount: <amount> <symbol>" followed by a newline
|
// Regex to match "Maximum amount: <amount> <symbol>" followed by a newline
|
||||||
re := regexp.MustCompile(`(?m)^Maximum amount:\s+(\d+(\.\d+)?)\s+([A-Z]+)`)
|
re := regexp.MustCompile(`(?m)^Maximum amount:\s+(\d+(\.\d+)?)\s+([A-Z]+)`)
|
||||||
match := re.FindSubmatch(response)
|
match := re.FindSubmatch(response)
|
||||||
if match != nil && len(match) > 0 {
|
if match != nil {
|
||||||
return string(match[1]) + " " + string(match[3]) // "<amount> <symbol>"
|
return string(match[1]) + " " + string(match[3]) // "<amount> <symbol>"
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
@ -324,7 +324,6 @@ func TestMainMenuSend(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func TestGroups(t *testing.T) {
|
func TestGroups(t *testing.T) {
|
||||||
groups, err := driver.LoadTestGroups(groupTestFile)
|
groups, err := driver.LoadTestGroups(groupTestFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user