From 14f8930f4a3cbddb09c8b5576f49dbe2d1ca2123 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 14 Jun 2023 08:54:52 +0200 Subject: [PATCH] Fix ArgumentError when loading newer Private Mentions (#25399) --- .../api/v1/conversations_controller_spec.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/spec/controllers/api/v1/conversations_controller_spec.rb b/spec/controllers/api/v1/conversations_controller_spec.rb index 2734e4a07b..e60b1e8037 100644 --- a/spec/controllers/api/v1/conversations_controller_spec.rb +++ b/spec/controllers/api/v1/conversations_controller_spec.rb @@ -52,5 +52,23 @@ RSpec.describe Api::V1::ConversationsController do end end end + + context 'with since_id' do + context 'when requesting old posts' do + it 'returns conversations' do + get :index, params: { since_id: Mastodon::Snowflake.id_at(1.hour.ago, with_random: false) } + json = body_as_json + expect(json.size).to eq 1 + end + end + + context 'when requesting posts in the future' do + it 'returns no conversation' do + get :index, params: { since_id: Mastodon::Snowflake.id_at(1.hour.from_now, with_random: false) } + json = body_as_json + expect(json.size).to eq 0 + end + end + end end end