Skip to content

Commit

Permalink
DEV: Backfill test for report fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nattsw committed Sep 5, 2023
1 parent 3411bdd commit 95d6d38
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions spec/reports/reactions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,30 @@
post_action_data = report.data.find { |x| x[:day] === 1.day.ago.to_date }
expect(post_action_data[:like_count]).to eq(2)
end

it "includes reactions on the start dates and end dates" do
reaction_cat = Fabricate(:reaction, post: post_1, reaction_value: "cat")
Fabricate(
:reaction_user,
reaction: reaction_cat,
user: user_1,
post: post_1,
created_at: 2.days.ago,
)
Fabricate(
:reaction_user,
reaction: reaction_cat,
user: user_2,
post: post_1,
created_at: Time.current,
)

report = Report.find("reactions", start_date: 2.days.ago, end_date: Time.current)

expect(report.data).to contain_exactly(
a_hash_including("cat_count" => 1, :day => 2.days.ago.to_date, :like_count => 0),
a_hash_including(day: 1.days.ago.to_date, like_count: 0),
a_hash_including("cat_count" => 1, :day => Time.current.to_date, :like_count => 0),
)
end
end

0 comments on commit 95d6d38

Please sign in to comment.