mirror of
https://github.com/we-promise/sure.git
synced 2026-05-31 16:29:03 +00:00
Perf/dashboard endpoint optimization (#1897)
* optimize net_category_totals() by using memoized cache * fix issue - net_category_totals cache is never populated - suggested by coderabbitAI * fix 422 error for service-worker * remove warning of [assigned but unused variables] - income_statement.rb * remove warnings of [assigned but unused] from Prism - income_statement_test.rb * add some measurements to improve docstring coverage, follow CodeRabbit recommendation * attach Skylight monitoring for dev env as well - use my own Skylight auth token * integrate Skylight with my own account auth token for local benchmark * fix PR review suggestion - Move fallback release-note copy to i18n keys * follow PR review - Fix changelog GitHub fetch timeout bounding * FIX - Variable shadowing; Prefer stubbing the specific instance over any_instance.expects * fix CodeRabbit feedback - Reusing the same stub for both classifications hides a contract mismatch * fix CodeRabbit FEEDBACK - Reconsider enabling Skylight by default in development * fix CodeRabbitAI FEEDBACK - reconsider unconditionally enabling Skylight in development * fix Security scan FEEDBACK before PR merge * fix jjmata feedback
This commit is contained in:
@@ -14,6 +14,39 @@ class PagesControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response :ok
|
||||
end
|
||||
|
||||
test "dashboard memoizes income statement period totals while rendering" do
|
||||
income_statement = IncomeStatement.new(@family)
|
||||
IncomeStatement.stubs(:new).returns(income_statement)
|
||||
|
||||
fake_expense_period_total = IncomeStatement::PeriodTotal.new(
|
||||
classification: "expense",
|
||||
total: 0,
|
||||
currency: @family.currency,
|
||||
category_totals: []
|
||||
)
|
||||
|
||||
fake_income_period_total = IncomeStatement::PeriodTotal.new(
|
||||
classification: "income",
|
||||
total: 0,
|
||||
currency: @family.currency,
|
||||
category_totals: []
|
||||
)
|
||||
|
||||
income_statement.expects(:build_period_total)
|
||||
.with(classification: "expense", period: kind_of(Period))
|
||||
.once
|
||||
.returns(fake_expense_period_total)
|
||||
|
||||
income_statement.expects(:build_period_total)
|
||||
.with(classification: "income", period: kind_of(Period))
|
||||
.once
|
||||
.returns(fake_income_period_total)
|
||||
|
||||
get root_path
|
||||
|
||||
assert_response :ok
|
||||
end
|
||||
|
||||
test "intro page requires guest role" do
|
||||
get intro_path
|
||||
|
||||
|
||||
Reference in New Issue
Block a user