Files
sure/test/models/entry_test.rb
Jonathan Chang b9716a0485 fix: Transaction Pagination Skipping Entries (#2179)
* Fix transaction pagination regressions and CI blockers

* Rails EOL already fixed

---------

Co-authored-by: Juan José Mata <jjmata@jjmata.com>
2026-06-16 10:51:51 +02:00

26 lines
737 B
Ruby

require "test_helper"
class EntryTest < ActiveSupport::TestCase
include EntriesTestHelper
test "chronological ordering uses id as final tie breaker" do
account = accounts(:depository)
timestamp = Time.zone.parse("2026-05-05 12:00:00")
entries = 3.times.map do |index|
create_transaction(
account: account,
name: "Same timestamp transaction #{index}",
date: Date.new(2026, 5, 5),
created_at: timestamp,
updated_at: timestamp
)
end
entry_ids = entries.map(&:id)
assert_equal entry_ids.sort, Entry.where(id: entry_ids).chronological.pluck(:id)
assert_equal entry_ids.sort.reverse, Entry.where(id: entry_ids).reverse_chronological.pluck(:id)
end
end