Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 1cbf9a3

Browse files
committed
FIX: and add export spec
1 parent 005e80f commit 1cbf9a3

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

spec/lib/modules/sentiment/entry_point_spec.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,23 @@ def sentiment_classification(post, classification)
5555
sentiment_classification(pm, positive_classification)
5656

5757
report = Report.find("overall_sentiment")
58-
overall_sentiment = report.data[:data][0][:y].to_i
58+
overall_sentiment = report.data[0][:data][0][:y].to_i
5959
expect(overall_sentiment).to eq(0)
6060
end
61+
62+
it "exports the report without any errors" do
63+
sentiment_classification(post_1, positive_classification)
64+
sentiment_classification(post_2, negative_classification)
65+
sentiment_classification(pm, positive_classification)
66+
67+
exporter = Jobs::ExportCsvFile.new
68+
exporter.entity = "report"
69+
exporter.extra = HashWithIndifferentAccess.new(name: "overall_sentiment")
70+
exported_csv = []
71+
exporter.report_export { |entry| exported_csv << entry }
72+
expect(exported_csv[0]).to eq(["Day", "Overall sentiment (Positive - Negative)"])
73+
expect(exported_csv[1]).to eq([post_1.created_at.to_date.to_s, "0"])
74+
end
6175
end
6276

6377
describe "post_emotion report" do

0 commit comments

Comments
 (0)