mirror of
https://github.com/we-promise/sure.git
synced 2026-07-12 21:05:20 +00:00
* Fix transaction pagination regressions and CI blockers * Rails EOL already fixed --------- Co-authored-by: Juan José Mata <jjmata@jjmata.com>
26 lines
737 B
Ruby
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
|