This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
spec/lib/modules/sentiment Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments