mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-25 08:09:38 +02:00
Dashboard View and Calculations (#521)
* Handle Turbo updates with tabs Fixes #491 * Add Filterable concern for controllers * Add trendline chart * Extract common UI to partials * Series refactor * Put placeholders for calculations in * Add classification generated column to account * Add basic net worth calculation * Add net worth tests * Get net worth graph working * Fix lint errors * Implement asset grouping query * Make trends and series more intuitive * Fully functional dashboard * Remove logging
This commit is contained in:
parent
680a91d807
commit
6f0e410684
37 changed files with 594 additions and 74 deletions
37
test/models/trend_test.rb
Normal file
37
test/models/trend_test.rb
Normal file
|
@ -0,0 +1,37 @@
|
|||
require "test_helper"
|
||||
|
||||
class TrendTest < ActiveSupport::TestCase
|
||||
test "up" do
|
||||
trend = Trend.new(current: 100, previous: 50)
|
||||
assert_equal "up", trend.direction
|
||||
end
|
||||
|
||||
test "down" do
|
||||
trend = Trend.new(current: 50, previous: 100)
|
||||
assert_equal "down", trend.direction
|
||||
end
|
||||
|
||||
test "flat" do
|
||||
trend = Trend.new(current: 100, previous: 100)
|
||||
assert_equal "flat", trend.direction
|
||||
end
|
||||
|
||||
test "infinitely up" do
|
||||
trend1 = Trend.new(current: 100, previous: nil)
|
||||
trend2 = Trend.new(current: 100, previous: 0)
|
||||
assert_equal "up", trend1.direction
|
||||
assert_equal "up", trend2.direction
|
||||
end
|
||||
|
||||
test "infinitely down" do
|
||||
trend1 = Trend.new(current: nil, previous: 100)
|
||||
trend2 = Trend.new(current: 0, previous: 100)
|
||||
assert_equal "down", trend1.direction
|
||||
assert_equal "down", trend2.direction
|
||||
end
|
||||
|
||||
test "empty" do
|
||||
trend = Trend.new
|
||||
assert_equal "flat", trend.direction
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue