Files
leadchat/spec/services/internal/remove_stale_redis_keys_service_spec.rb
Vishnu Narayanan 9a405d65ba fix: RemoveStaleRedisKeys service (#10562)
Fixes issues with RemoveStaleRedisKeys service

Co-authored-by: Sojan <sojan@pepalo.com>
2024-12-11 03:38:25 +08:00

19 lines
522 B
Ruby

require 'rails_helper'
RSpec.describe Internal::RemoveStaleRedisKeysService, type: :service do
let(:account_id) { 1 }
let(:service) { described_class.new(account_id: account_id) }
describe '#perform' do
it 'removes stale Redis keys for the specified account' do
presence_key = OnlineStatusTracker.presence_key(account_id, 'Contact')
# Mock Redis calls
expect(Redis::Alfred).to receive(:zremrangebyscore)
.with(presence_key, '-inf', anything)
service.perform
end
end
end