mirror of
https://github.com/we-promise/sure.git
synced 2026-09-05 06:41:08 +00:00
fix(sparklines): prevent crash when trend is nil for empty series (#3171)
* fix(sparklines): prevent crash when trend is nil for empty series * Test sparklines without trend data --------- Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
This commit is contained in:
co-authored by
sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
Juan José Mata
parent
c8c530d885
commit
db181eb84f
@@ -10,6 +10,22 @@ class AccountableSparklinesControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "show renders an empty series without a trend" do
|
||||
empty_series = Series.new(
|
||||
start_date: 1.day.ago.to_date,
|
||||
end_date: Date.current,
|
||||
interval: "1 day",
|
||||
values: []
|
||||
)
|
||||
Rails.cache.clear
|
||||
Balance::ChartSeriesBuilder.any_instance.expects(:balance_series).returns(empty_series)
|
||||
|
||||
get accountable_sparkline_url("depository")
|
||||
|
||||
assert_response :success
|
||||
assert_select "p.font-mono", count: 0
|
||||
end
|
||||
|
||||
test "linked investment sparkline does not load full account records" do
|
||||
AccountProvider.create!(
|
||||
account: accounts(:investment),
|
||||
|
||||
Reference in New Issue
Block a user