Merge remote-tracking branch 'parent/main' into upstream-20240117

This commit is contained in:
KMY 2025-01-17 16:29:11 +09:00
commit 5d79bd078c
150 changed files with 2982 additions and 1485 deletions

View file

@ -45,6 +45,45 @@ RSpec.describe Trends::Statuses do
end
end
describe 'Trends::Statuses::Query methods' do
subject { described_class.new.query }
describe '#records' do
context 'with scored cards' do
let!(:higher_score) { Fabricate :status_trend, score: 10, language: 'en' }
let!(:lower_score) { Fabricate :status_trend, score: 1, language: 'es' }
it 'returns higher score first' do
expect(subject.records)
.to eq([higher_score.status, lower_score.status])
end
context 'with preferred locale' do
before { subject.in_locale!('es') }
it 'returns in language order' do
expect(subject.records)
.to eq([lower_score.status, higher_score.status])
end
end
context 'when account has chosen languages' do
let!(:lang_match_higher_score) { Fabricate :status_trend, score: 10, language: 'is' }
let!(:lang_match_lower_score) { Fabricate :status_trend, score: 1, language: 'da' }
let(:user) { Fabricate :user, chosen_languages: %w(da is) }
let(:account) { Fabricate :account, user: user }
before { subject.filtered_for!(account) }
it 'returns results' do
expect(subject.records)
.to eq([lang_match_higher_score.status, lang_match_lower_score.status, higher_score.status, lower_score.status])
end
end
end
end
end
describe '#add' do
let(:status) { Fabricate(:status) }