add tests

This commit is contained in:
Carlosokumu 2024-09-14 20:01:58 +03:00
parent b5d33a98f0
commit e99a788c60
Signed by: carlos
GPG Key ID: 7BD6BC8160A5C953
2 changed files with 1403 additions and 5 deletions

View File

@ -74,9 +74,9 @@ func NewHandlers(appFlags *asm.FlagParser, userdataStore db.Db) (*Handlers, erro
Db: userdataStore,
}
h := &Handlers{
userdataStore: userDb,
flagManager: appFlags,
accountService: &server.AccountService{},
userdataStore: userDb,
flagManager: appFlags,
accountService: &server.AccountService{},
}
return h, nil
}
@ -748,7 +748,8 @@ func (h *Handlers) ValidateAmount(ctx context.Context, sym string, input []byte)
flag_invalid_amount, _ := h.flagManager.GetFlag("flag_invalid_amount")
publicKey, _ := utils.ReadEntry(ctx, h.userdataStore, sessionId, utils.DATA_PUBLIC_KEY)
store := h.userdataStore
publicKey, _ := store.ReadEntry(ctx, sessionId, utils.DATA_PUBLIC_KEY)
amountStr := string(input)
@ -792,7 +793,6 @@ func (h *Handlers) ValidateAmount(ctx context.Context, sym string, input []byte)
}
res.Content = fmt.Sprintf("%.3f", inputAmount) // Format to 3 decimal places
store := h.userdataStore
err = store.WriteEntry(ctx, sessionId, utils.DATA_AMOUNT, []byte(amountStr))
if err != nil {
return res, err

File diff suppressed because it is too large Load Diff