Skip to content

Commit 6b320a3

Browse files
committed
check that wrong assets are not included
1 parent 1fdea93 commit 6b320a3

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

internal/storage/ledger/transactions_test.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,15 @@ func TestTransactionsList(t *testing.T) {
739739
err = store.CommitTransaction(ctx, &tx6, nil)
740740
require.NoError(t, err)
741741

742+
tx7 := ledger.NewTransaction().
743+
WithPostings(
744+
ledger.NewPosting("world", "users:charlie", "EUR", big.NewInt(30)),
745+
ledger.NewPosting("world", "users:charlie", "USD", big.NewInt(30)),
746+
).
747+
WithTimestamp(now)
748+
err = store.CommitTransaction(ctx, &tx7, nil)
749+
require.NoError(t, err)
750+
742751
type testCase struct {
743752
name string
744753
query common.InitialPaginatedQuery[any]
@@ -749,7 +758,7 @@ func TestTransactionsList(t *testing.T) {
749758
{
750759
name: "nominal",
751760
query: common.InitialPaginatedQuery[any]{},
752-
expected: []ledger.Transaction{tx6, tx5, tx4, tx3, tx2, tx1},
761+
expected: []ledger.Transaction{tx7, tx6, tx5, tx4, tx3, tx2, tx1},
753762
},
754763
{
755764
name: "address filter",
@@ -776,7 +785,7 @@ func TestTransactionsList(t *testing.T) {
776785
Builder: query.Match("account", "users:"),
777786
},
778787
},
779-
expected: []ledger.Transaction{tx6, tx5, tx4, tx3},
788+
expected: []ledger.Transaction{tx7, tx6, tx5, tx4, tx3},
780789
},
781790
{
782791
name: "address filter using segment and unbounded segment list",
@@ -785,7 +794,7 @@ func TestTransactionsList(t *testing.T) {
785794
Builder: query.Match("account", "users:..."),
786795
},
787796
},
788-
expected: []ledger.Transaction{tx6, tx5, tx4, tx3},
797+
expected: []ledger.Transaction{tx7, tx6, tx5, tx4, tx3},
789798
},
790799
{
791800
name: "filter using metadata",
@@ -855,7 +864,7 @@ func TestTransactionsList(t *testing.T) {
855864
Builder: query.Not(query.Exists("metadata", "category")),
856865
},
857866
},
858-
expected: []ledger.Transaction{tx6, tx5, tx4},
867+
expected: []ledger.Transaction{tx7, tx6, tx5, tx4},
859868
},
860869
{
861870
name: "filter using timestamp",
@@ -864,7 +873,7 @@ func TestTransactionsList(t *testing.T) {
864873
Builder: query.Match("timestamp", tx5.Timestamp.Format(time.RFC3339Nano)),
865874
},
866875
},
867-
expected: []ledger.Transaction{tx6, tx5, tx4},
876+
expected: []ledger.Transaction{tx7, tx6, tx5, tx4},
868877
},
869878
{
870879
name: "filter using amount",

0 commit comments

Comments
 (0)