From bca4840ca6c91b884478a1d4a00d980098a9f526 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Mon, 26 Dec 2022 13:22:07 +0100 Subject: [PATCH] test: Add a test to ensure the library cannot get stuck --- test/omemomanager_test.dart | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/omemomanager_test.dart b/test/omemomanager_test.dart index 5b65a65..b6c5c08 100644 --- a/test/omemomanager_test.dart +++ b/test/omemomanager_test.dart @@ -217,4 +217,30 @@ void main() { expect(bobEmptyMessageSent, 2); expect(bobResultFinal.payload, 'Test message last'); }); + + test('Test accessing data without it existing', () async { + const aliceJid = 'alice@server1'; + const bobJid = 'bob@server2'; + final aliceDevice = await Device.generateNewDevice(aliceJid, opkAmount: 1); + + final aliceManager = omemo.OmemoManager( + aliceDevice, + AlwaysTrustingTrustManager(), + (result, recipientJid) async {}, + (jid) async => [], + (jid, id) async => null, + ); + + // Get non-existant fingerprints + expect( + await aliceManager.getFingerprintsForJid(bobJid), + null, + ); + + // Ack a non-existant ratchet + await aliceManager.ratchetAcknowledged( + bobJid, + 42, + ); + }); }