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