2023-02-24 11:25:02 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require_relative "../../../support/sentiment_inference_stubs"
|
|
|
|
|
2023-03-14 15:03:50 -04:00
|
|
|
describe DiscourseAi::Sentiment::SentimentClassification do
|
2023-02-27 14:21:40 -05:00
|
|
|
fab!(:target) { Fabricate(:post) }
|
2023-02-24 11:25:02 -05:00
|
|
|
|
2023-02-27 14:21:40 -05:00
|
|
|
describe "#request" do
|
2023-02-24 11:25:02 -05:00
|
|
|
before { SiteSetting.ai_sentiment_inference_service_api_endpoint = "http://test.com" }
|
|
|
|
|
|
|
|
it "returns the classification and the model used for it" do
|
|
|
|
SentimentInferenceStubs.stub_classification(target)
|
|
|
|
|
|
|
|
result = subject.request(target)
|
|
|
|
|
|
|
|
subject.available_models.each do |model|
|
|
|
|
expect(result[model]).to eq(SentimentInferenceStubs.model_response(model))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|