From d654665604fb6f60c0a0b00d3e130a67ad925e35 Mon Sep 17 00:00:00 2001 From: sacOO7 Date: Thu, 16 May 2024 21:27:49 +0530 Subject: [PATCH] Added test for invalid recovery key --- spec/unit/realtime/recovery_key_context_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/unit/realtime/recovery_key_context_spec.rb b/spec/unit/realtime/recovery_key_context_spec.rb index 7c3a1a7f..56feb70b 100644 --- a/spec/unit/realtime/recovery_key_context_spec.rb +++ b/spec/unit/realtime/recovery_key_context_spec.rb @@ -26,5 +26,11 @@ expect(decoded_recovery_key.msg_serial).to eq(123) end + it 'should return nil for invalid recovery key' do + encoded_recovery_key = "{\"invalid key\"}" + decoded_recovery_key = Ably::Realtime::RecoveryKeyContext.from_json(encoded_recovery_key) + expect(decoded_recovery_key).to be_nil + end + end end