neq quotation definition + priced_at field
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
moneyv1 "github.com/tech/sendico/pkg/proto/common/money/v1"
|
||||
oraclev1 "github.com/tech/sendico/pkg/proto/oracle/v1"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
type stubOracle struct {
|
||||
@@ -75,6 +76,7 @@ func TestLatestRate(t *testing.T) {
|
||||
|
||||
func TestGetQuote(t *testing.T) {
|
||||
expiresAt := time.Date(2024, 2, 2, 12, 0, 0, 0, time.UTC)
|
||||
pricedAt := time.Date(2024, 2, 2, 11, 59, 0, 0, time.UTC)
|
||||
stub := &stubOracle{
|
||||
quoteResp: &oraclev1.GetQuoteResponse{
|
||||
Quote: &oraclev1.Quote{
|
||||
@@ -85,6 +87,7 @@ func TestGetQuote(t *testing.T) {
|
||||
BaseAmount: &moneyv1.Money{Amount: "100.00", Currency: "GBP"},
|
||||
QuoteAmount: &moneyv1.Money{Amount: "125.00", Currency: "USD"},
|
||||
ExpiresAtUnixMs: expiresAt.UnixMilli(),
|
||||
PricedAt: timestamppb.New(pricedAt),
|
||||
Provider: "Test",
|
||||
RateRef: "test-ref",
|
||||
Firm: true,
|
||||
@@ -113,4 +116,7 @@ func TestGetQuote(t *testing.T) {
|
||||
if resp.QuoteRef != "quote-123" || resp.Price != "1.2500" || !resp.ExpiresAt.Equal(expiresAt) {
|
||||
t.Fatalf("unexpected quote response: %+v", resp)
|
||||
}
|
||||
if !resp.PricedAt.Equal(pricedAt) {
|
||||
t.Fatalf("expected priced_at %s, got %s", pricedAt, resp.PricedAt)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user