Add a chart showing all events in admin stats
Not sure it's useful, but it makes the main admin stats page a bit more interesting.
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe Admin::Stats::EventLinksComponent do
|
||||
it "renders an <h2> heading followed by a list of links" do
|
||||
it "renders a list of links" do
|
||||
render_inline Admin::Stats::EventLinksComponent.new(
|
||||
%w[legislation_annotation_created legislation_answer_created]
|
||||
)
|
||||
|
||||
expect(page).to have_css "h2", exact_text: "Graphs"
|
||||
expect(page).to have_link count: 2
|
||||
|
||||
page.find("ul") do |list|
|
||||
|
||||
18
spec/components/admin/stats/global_chart_component_spec.rb
Normal file
18
spec/components/admin/stats/global_chart_component_spec.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe Admin::Stats::GlobalChartComponent do
|
||||
before do
|
||||
allow(Ahoy::Chart).to receive(:active_event_names).and_return(
|
||||
%i[budget_investment_created level_3_user]
|
||||
)
|
||||
end
|
||||
|
||||
it "renders an <h2> tag with a graph and links" do
|
||||
render_inline Admin::Stats::GlobalChartComponent.new
|
||||
|
||||
expect(page).to have_css "h2", exact_text: "Graphs"
|
||||
expect(page).to have_css "[data-graph]"
|
||||
expect(page).to have_link "Budget investments created"
|
||||
expect(page).to have_link "Level 3 users verified"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user