mirror of
https://github.com/aclindsa/moneygo.git
synced 2024-12-26 23:42:29 -05:00
testing: Use Time.Equal for date comparisons
Postgres actually preserves the timezone, unlike sqlite and mysql...
This commit is contained in:
parent
00e1e899c0
commit
50dd7b1d26
@ -64,7 +64,7 @@ func TestCreatePrice(t *testing.T) {
|
|||||||
if p.CurrencyId != d.securities[orig.CurrencyId].SecurityId {
|
if p.CurrencyId != d.securities[orig.CurrencyId].SecurityId {
|
||||||
t.Errorf("CurrencyId doesn't match")
|
t.Errorf("CurrencyId doesn't match")
|
||||||
}
|
}
|
||||||
if p.Date != orig.Date {
|
if !p.Date.Equal(orig.Date) {
|
||||||
t.Errorf("Date doesn't match")
|
t.Errorf("Date doesn't match")
|
||||||
}
|
}
|
||||||
if p.Value != orig.Value {
|
if p.Value != orig.Value {
|
||||||
@ -94,7 +94,7 @@ func TestGetPrice(t *testing.T) {
|
|||||||
if p.CurrencyId != d.securities[orig.CurrencyId].SecurityId {
|
if p.CurrencyId != d.securities[orig.CurrencyId].SecurityId {
|
||||||
t.Errorf("CurrencyId doesn't match")
|
t.Errorf("CurrencyId doesn't match")
|
||||||
}
|
}
|
||||||
if p.Date != orig.Date {
|
if !p.Date.Equal(orig.Date) {
|
||||||
t.Errorf("Date doesn't match")
|
t.Errorf("Date doesn't match")
|
||||||
}
|
}
|
||||||
if p.Value != orig.Value {
|
if p.Value != orig.Value {
|
||||||
@ -131,7 +131,7 @@ func TestGetPrices(t *testing.T) {
|
|||||||
|
|
||||||
found := false
|
found := false
|
||||||
for _, p := range *pl.Prices {
|
for _, p := range *pl.Prices {
|
||||||
if p.SecurityId == d.securities[orig.SecurityId].SecurityId && p.CurrencyId == d.securities[orig.CurrencyId].SecurityId && p.Date == orig.Date && p.Value == orig.Value && p.RemoteId == orig.RemoteId {
|
if p.SecurityId == d.securities[orig.SecurityId].SecurityId && p.CurrencyId == d.securities[orig.CurrencyId].SecurityId && p.Date.Equal(orig.Date) && p.Value == orig.Value && p.RemoteId == orig.RemoteId {
|
||||||
if _, ok := foundIds[p.PriceId]; ok {
|
if _, ok := foundIds[p.PriceId]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ func TestUpdatePrice(t *testing.T) {
|
|||||||
if p.CurrencyId != curr.CurrencyId {
|
if p.CurrencyId != curr.CurrencyId {
|
||||||
t.Errorf("CurrencyId doesn't match")
|
t.Errorf("CurrencyId doesn't match")
|
||||||
}
|
}
|
||||||
if p.Date != curr.Date {
|
if !p.Date.Equal(curr.Date) {
|
||||||
t.Errorf("Date doesn't match")
|
t.Errorf("Date doesn't match")
|
||||||
}
|
}
|
||||||
if p.Value != curr.Value {
|
if p.Value != curr.Value {
|
||||||
|
@ -87,8 +87,8 @@ func ensureTransactionsMatch(t *testing.T, expected, tran *handlers.Transaction,
|
|||||||
if tran.Description != expected.Description {
|
if tran.Description != expected.Description {
|
||||||
t.Errorf("Description doesn't match")
|
t.Errorf("Description doesn't match")
|
||||||
}
|
}
|
||||||
if tran.Date != expected.Date {
|
if !tran.Date.Equal(expected.Date) {
|
||||||
t.Errorf("Date doesn't match")
|
t.Errorf("Date (%+v) differs from expected (%+v)", tran.Date, expected.Date)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(tran.Splits) != len(expected.Splits) {
|
if len(tran.Splits) != len(expected.Splits) {
|
||||||
|
Loading…
Reference in New Issue
Block a user