Compare commits
5 Commits
c7f0ddec9b
...
67062a41ad
Author | SHA1 | Date | |
---|---|---|---|
67062a41ad | |||
123fdec009 | |||
20694d956b | |||
10abad9e59 | |||
ca366ee2bc |
@ -1,129 +0,0 @@
|
|||||||
//go:build !online
|
|
||||||
// +build !online
|
|
||||||
|
|
||||||
package server
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/alecthomas/assert/v2"
|
|
||||||
"gopkg.in/dnaeon/go-vcr.v4/pkg/recorder"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestCheckBalanceOffline(t *testing.T) {
|
|
||||||
r, err := recorder.New("custodial/balance")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
defer r.Stop()
|
|
||||||
|
|
||||||
client := r.GetDefaultClient()
|
|
||||||
|
|
||||||
as := AccountService{
|
|
||||||
Client: client,
|
|
||||||
}
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
balance string
|
|
||||||
publicKey string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "Test check balance with correct public key",
|
|
||||||
publicKey: "0x216a4A64E1e699F9d65Dd9CbD0058dAB21DeF002",
|
|
||||||
balance: "3.06000000003 CELO",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Test check balance with public key that doesn't exist in the custodial system",
|
|
||||||
balance: "",
|
|
||||||
publicKey: "0x216a4A64E1e699F9d65Dd9CbD0058dAB21DeF00",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
balance, err := as.CheckBalance(tt.publicKey)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Failed to get balance with error %s", err)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.Equal(t, balance, tt.balance, "Expected balance and actual balance should be equal")
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCheckAccountStatusOffline(t *testing.T) {
|
|
||||||
r, err := recorder.New("custodial/status")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
defer r.Stop()
|
|
||||||
|
|
||||||
client := r.GetDefaultClient()
|
|
||||||
|
|
||||||
as := AccountService{
|
|
||||||
Client: client,
|
|
||||||
}
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
status string
|
|
||||||
trackingId string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "Test check status with tracking id that exists in the custodial system",
|
|
||||||
trackingId: "bb23945b-65cd-4110-ac2e-a5df40572e18",
|
|
||||||
status: "SUCCESS",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Test check status with tracking id that doesn't exist in the custodial system",
|
|
||||||
status: "",
|
|
||||||
trackingId: "bb23945b-65cd-4110-ac2e-a5df40572e1",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
status, err := as.CheckAccountStatus(tt.trackingId)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Failed to account status with error %s", err)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.Equal(t, status, tt.status, "Expected status and actual status should be equal")
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCreateAccountOffline(t *testing.T) {
|
|
||||||
r, err := recorder.New("custodial/create")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
defer r.Stop()
|
|
||||||
|
|
||||||
client := r.GetDefaultClient()
|
|
||||||
|
|
||||||
as := AccountService{
|
|
||||||
Client: client,
|
|
||||||
}
|
|
||||||
accountRes, err := as.CreateAccount()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Failed to create an account with error %s", err)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.Equal(t, accountRes.Ok, true, "account response status is true")
|
|
||||||
|
|
||||||
}
|
|
@ -1,130 +0,0 @@
|
|||||||
//go:build online
|
|
||||||
// +build online
|
|
||||||
|
|
||||||
package server
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/alecthomas/assert/v2"
|
|
||||||
"gopkg.in/dnaeon/go-vcr.v4/pkg/recorder"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestCheckBalance(t *testing.T) {
|
|
||||||
r, err := recorder.New("custodial/balance")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
defer r.Stop()
|
|
||||||
|
|
||||||
client := &http.Client{}
|
|
||||||
|
|
||||||
as := AccountService{
|
|
||||||
Client: client,
|
|
||||||
}
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
balance string
|
|
||||||
publicKey string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "Test check balance with correct public key",
|
|
||||||
publicKey: "0x216a4A64E1e699F9d65Dd9CbD0058dAB21DeF002",
|
|
||||||
balance: "3.06000000003 CELO",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Test check balance with public key that doesn't exist in the custodial system",
|
|
||||||
balance: "",
|
|
||||||
publicKey: "0x216a4A64E1e699F9d65Dd9CbD0058dAB21DeF00",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
balance, err := as.CheckBalance(tt.publicKey)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Failed to get balance with error %s", err)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.Equal(t, balance, tt.balance, "Expected balance and actual balance should be equal")
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCheckAccountStatus(t *testing.T) {
|
|
||||||
r, err := recorder.New("custodial/status")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
defer r.Stop()
|
|
||||||
|
|
||||||
client := &http.Client{}
|
|
||||||
|
|
||||||
as := AccountService{
|
|
||||||
Client: client,
|
|
||||||
}
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
status string
|
|
||||||
trackingId string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "Test check status with tracking id that exists in the custodial system",
|
|
||||||
trackingId: "bb23945b-65cd-4110-ac2e-a5df40572e18",
|
|
||||||
status: "SUCCESS",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Test check status with tracking id that doesn't exist in the custodial system",
|
|
||||||
status: "",
|
|
||||||
trackingId: "bb23945b-65cd-4110-ac2e-a5df40572e1",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
status, err := as.CheckAccountStatus(tt.trackingId)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Failed to account status with error %s", err)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.Equal(t, status, tt.status, "Expected status and actual status should be equal")
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCreateAccount(t *testing.T) {
|
|
||||||
r, err := recorder.New("custodial/create")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
defer r.Stop()
|
|
||||||
|
|
||||||
client := &http.Client{}
|
|
||||||
|
|
||||||
as := AccountService{
|
|
||||||
Client: client,
|
|
||||||
}
|
|
||||||
accountRes, err := as.CreateAccount()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Failed to create an account with error %s", err)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.Equal(t, accountRes.Ok, true, "account response status is true")
|
|
||||||
|
|
||||||
}
|
|
@ -19,8 +19,6 @@ type AccountService struct {
|
|||||||
Client *http.Client
|
Client *http.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// CheckAccountStatus retrieves the status of an account transaction based on the provided tracking ID.
|
// CheckAccountStatus retrieves the status of an account transaction based on the provided tracking ID.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
@ -28,15 +26,12 @@ type AccountService struct {
|
|||||||
// CreateAccount or a similar function that returns an AccountResponse. The `trackingId` field in the
|
// CreateAccount or a similar function that returns an AccountResponse. The `trackingId` field in the
|
||||||
// AccountResponse struct can be used here to check the account status during a transaction.
|
// AccountResponse struct can be used here to check the account status during a transaction.
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// Returns:
|
// Returns:
|
||||||
// - string: The status of the transaction as a string. If there is an error during the request or processing, this will be an empty string.
|
// - string: The status of the transaction as a string. If there is an error during the request or processing, this will be an empty string.
|
||||||
// - error: An error if any occurred during the HTTP request, reading the response, or unmarshalling the JSON data.
|
// - error: An error if any occurred during the HTTP request, reading the response, or unmarshalling the JSON data.
|
||||||
// If no error occurs, this will be nil.
|
// If no error occurs, this will be nil.
|
||||||
//
|
|
||||||
func (as *AccountService) CheckAccountStatus(trackingId string) (string, error) {
|
func (as *AccountService) CheckAccountStatus(trackingId string) (string, error) {
|
||||||
resp,err := as.Client.Get(config.TrackStatusURL + trackingId)
|
resp, err := as.Client.Get(config.TrackStatusURL + trackingId)
|
||||||
// resp, err := http.Get(config.TrackStatusURL + trackingId)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -52,20 +47,16 @@ func (as *AccountService) CheckAccountStatus(trackingId string) (string, error)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
status := trackResp.Result.Transaction.Status
|
status := trackResp.Result.Transaction.Status
|
||||||
|
|
||||||
return status, nil
|
return status, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// CheckBalance retrieves the balance for a given public key from the custodial balance API endpoint.
|
// CheckBalance retrieves the balance for a given public key from the custodial balance API endpoint.
|
||||||
// Parameters:
|
// Parameters:
|
||||||
// - publicKey: The public key associated with the account whose balance needs to be checked.
|
// - publicKey: The public key associated with the account whose balance needs to be checked.
|
||||||
func (as *AccountService) CheckBalance(publicKey string) (string, error) {
|
func (as *AccountService) CheckBalance(publicKey string) (string, error) {
|
||||||
|
resp, err := http.Get(config.BalanceURL + publicKey)
|
||||||
//resp, err := http.Get(config.BalanceURL + publicKey)
|
|
||||||
resp, err := as.Client.Get(config.BalanceURL + publicKey)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "0.0", err
|
return "0.0", err
|
||||||
}
|
}
|
||||||
@ -86,15 +77,13 @@ func (as *AccountService) CheckBalance(publicKey string) (string, error) {
|
|||||||
return balance, nil
|
return balance, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateAccount creates a new account in the custodial system.
|
||||||
//CreateAccount creates a new account in the custodial system.
|
|
||||||
// Returns:
|
// Returns:
|
||||||
// - *models.AccountResponse: A pointer to an AccountResponse struct containing the details of the created account.
|
// - *models.AccountResponse: A pointer to an AccountResponse struct containing the details of the created account.
|
||||||
// If there is an error during the request or processing, this will be nil.
|
// If there is an error during the request or processing, this will be nil.
|
||||||
// - error: An error if any occurred during the HTTP request, reading the response, or unmarshalling the JSON data.
|
// - error: An error if any occurred during the HTTP request, reading the response, or unmarshalling the JSON data.
|
||||||
// If no error occurs, this will be nil.
|
// If no error occurs, this will be nil.
|
||||||
func (as *AccountService) CreateAccount() (*models.AccountResponse, error) {
|
func (as *AccountService) CreateAccount() (*models.AccountResponse, error) {
|
||||||
//resp, err := http.Post(config.CreateAccountURL, "application/json", nil)
|
|
||||||
resp, err := as.Client.Post(config.CreateAccountURL, "application/json", nil)
|
resp, err := as.Client.Post(config.CreateAccountURL, "application/json", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -111,6 +100,5 @@ func (as *AccountService) CreateAccount() (*models.AccountResponse, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &accountResp, nil
|
return &accountResp, nil
|
||||||
}
|
}
|
||||||
|
@ -1,126 +0,0 @@
|
|||||||
package server
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/alecthomas/assert/v2"
|
|
||||||
"gopkg.in/dnaeon/go-vcr.v4/pkg/recorder"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestCheckBalance(t *testing.T) {
|
|
||||||
r, err := recorder.New("custodial/balance")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
defer r.Stop()
|
|
||||||
|
|
||||||
client := r.GetDefaultClient()
|
|
||||||
|
|
||||||
as := AccountService{
|
|
||||||
Client: client,
|
|
||||||
}
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
balance string
|
|
||||||
publicKey string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "Test check balance with correct public key",
|
|
||||||
publicKey: "0x216a4A64E1e699F9d65Dd9CbD0058dAB21DeF002",
|
|
||||||
balance: "3.06000000003 CELO",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Test check balance with public key that doesn't exist in the custodial system",
|
|
||||||
balance: "",
|
|
||||||
publicKey: "0x216a4A64E1e699F9d65Dd9CbD0058dAB21DeF00",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
balance, err := as.CheckBalance(tt.publicKey)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Failed to get balance with error %s", err)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.Equal(t, balance, tt.balance, "Expected balance and actual balance should be equal")
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCheckAccountStatus(t *testing.T) {
|
|
||||||
r, err := recorder.New("custodial/status")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
defer r.Stop()
|
|
||||||
|
|
||||||
client := r.GetDefaultClient()
|
|
||||||
|
|
||||||
as := AccountService{
|
|
||||||
Client: client,
|
|
||||||
}
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
status string
|
|
||||||
trackingId string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "Test check status with tracking id that exists in the custodial system",
|
|
||||||
trackingId: "bb23945b-65cd-4110-ac2e-a5df40572e18",
|
|
||||||
status: "SUCCESS",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Test check status with tracking id that doesn't exist in the custodial system",
|
|
||||||
status: "",
|
|
||||||
trackingId: "bb23945b-65cd-4110-ac2e-a5df40572e1",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tt := range tests {
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
status, err := as.CheckAccountStatus(tt.trackingId)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Failed to account status with error %s", err)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.Equal(t, status, tt.status, "Expected status and actual status should be equal")
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCreateAccount(t *testing.T) {
|
|
||||||
r, err := recorder.New("custodial/create")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
defer r.Stop()
|
|
||||||
|
|
||||||
client := r.GetDefaultClient()
|
|
||||||
|
|
||||||
as := AccountService{
|
|
||||||
Client: client,
|
|
||||||
}
|
|
||||||
accountRes, err := as.CreateAccount()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("Failed to create an account with error %s", err)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.Equal(t, accountRes.Ok, true, "account response status is true")
|
|
||||||
|
|
||||||
}
|
|
@ -569,6 +569,22 @@ func (h *Handlers) Quit(ctx context.Context, sym string, input []byte) (resource
|
|||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Quit displays the Thank you message and exits the menu
|
||||||
|
func (h *Handlers) QuitWithHelp(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||||
|
var res resource.Result
|
||||||
|
|
||||||
|
flag_account_authorized, _ := h.flagManager.GetFlag("flag_account_authorized")
|
||||||
|
|
||||||
|
code := codeFromCtx(ctx)
|
||||||
|
l := gotext.NewLocale(translationDir, code)
|
||||||
|
l.AddDomain("default")
|
||||||
|
|
||||||
|
res.Content = l.Get("For more help,please call: 0757628885")
|
||||||
|
res.FlagReset = append(res.FlagReset, flag_account_authorized)
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
// VerifyYob verifies the length of the given input
|
// VerifyYob verifies the length of the given input
|
||||||
func (h *Handlers) VerifyYob(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
func (h *Handlers) VerifyYob(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||||
var res resource.Result
|
var res resource.Result
|
||||||
|
@ -1378,6 +1378,61 @@ func TestQuit(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestQuitWithHelp(t *testing.T) {
|
||||||
|
fm, err := NewFlagManager(flagsPath)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
t.Logf(err.Error())
|
||||||
|
}
|
||||||
|
flag_account_authorized, _ := fm.parser.GetFlag("flag_account_authorized")
|
||||||
|
|
||||||
|
mockDataStore := new(mocks.MockUserDataStore)
|
||||||
|
mockCreateAccountService := new(mocks.MockAccountService)
|
||||||
|
|
||||||
|
sessionId := "session123"
|
||||||
|
|
||||||
|
ctx := context.WithValue(context.Background(), "SessionId", sessionId)
|
||||||
|
|
||||||
|
h := &Handlers{
|
||||||
|
userdataStore: mockDataStore,
|
||||||
|
accountService: mockCreateAccountService,
|
||||||
|
flagManager: fm.parser,
|
||||||
|
}
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
input []byte
|
||||||
|
status string
|
||||||
|
expectedResult resource.Result
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "Test quit with help message",
|
||||||
|
expectedResult: resource.Result{
|
||||||
|
FlagReset: []uint32{flag_account_authorized},
|
||||||
|
Content: "For more help,please call: 0757628885",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
|
||||||
|
// Call the method under test
|
||||||
|
res, _ := h.QuitWithHelp(ctx, "test_quit with help", tt.input)
|
||||||
|
|
||||||
|
// Assert that no errors occurred
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
//Assert that the account created flag has been set to the result
|
||||||
|
assert.Equal(t, res, tt.expectedResult, "Expected result should be equal to the actual result")
|
||||||
|
|
||||||
|
// Assert that expectations were met
|
||||||
|
mockDataStore.AssertExpectations(t)
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestIsValidPIN(t *testing.T) {
|
func TestIsValidPIN(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
Loading…
Reference in New Issue
Block a user