discourse-ai/spec/reports/sentiment_analysis_spec.rb
Jarek Radosz f231aad8b5
DEV: Disable the plugin by default (#1511)
…and preserve the current setting on existing sites
2025-07-22 11:05:52 +01:00

25 lines
827 B
Ruby

# frozen_string_literal: true
RSpec.describe DiscourseAi::Sentiment::SentimentAnalysisReport do
fab!(:admin)
fab!(:category)
fab!(:topic) { Fabricate(:topic, category: category) }
fab!(:post) { Fabricate(:post, user: admin, topic: topic) }
fab!(:post_2) { Fabricate(:post, user: admin, topic: topic) }
fab!(:classification_result) { Fabricate(:classification_result, target: post) }
before do
enable_current_plugin
SiteSetting.ai_sentiment_enabled = true
end
it "contains the correct filters" do
report = Report.find("sentiment_analysis")
expect(report.available_filters).to include("group_by", "sort_by", "category", "tag")
end
it "contains the correct labels" do
report = Report.find("sentiment_analysis")
expect(report.labels).to eq(%w[Positive Neutral Negative])
end
end