test: Add a test to ensure the library cannot get stuck

This commit is contained in:
PapaTutuWawa 2022-12-26 13:22:07 +01:00
parent caf841c53e
commit bca4840ca6

View File

@ -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,
);
});
}