From f065a924455b8b0420060a38e97d5d492b92fc48 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Fri, 5 Jun 2020 11:32:02 +0200 Subject: [PATCH] fix coverage --- test/encryption/encrypt_decrypt_room_message_test.dart | 4 ++++ test/encryption/encrypt_decrypt_to_device_test.dart | 5 +++++ test/encryption/key_manager_test.dart | 4 ++++ test/encryption/key_verification_test.dart | 4 ++++ test/encryption/olm_manager_test.dart | 4 ++++ test/room_test.dart | 4 ++-- test/timeline_test.dart | 7 ++++--- 7 files changed, 27 insertions(+), 5 deletions(-) diff --git a/test/encryption/encrypt_decrypt_room_message_test.dart b/test/encryption/encrypt_decrypt_room_message_test.dart index f2a46da..7227134 100644 --- a/test/encryption/encrypt_decrypt_room_message_test.dart +++ b/test/encryption/encrypt_decrypt_room_message_test.dart @@ -91,5 +91,9 @@ void main() { expect(decryptedEvent.content['msgtype'], 'm.text'); expect(decryptedEvent.content['text'], 'Hello foxies!'); }); + + test('dispose client', () async { + await client.dispose(closeDatabase: true); + }); }); } diff --git a/test/encryption/encrypt_decrypt_to_device_test.dart b/test/encryption/encrypt_decrypt_to_device_test.dart index 7a35d6f..0be0a19 100644 --- a/test/encryption/encrypt_decrypt_to_device_test.dart +++ b/test/encryption/encrypt_decrypt_to_device_test.dart @@ -111,5 +111,10 @@ void main() { expect(decryptedEvent.type, 'm.to_device'); expect(decryptedEvent.content['hello'], 'superfoxies'); }); + + test('dispose client', () async { + await client.dispose(closeDatabase: true); + await otherClient.dispose(closeDatabase: true); + }); }); } diff --git a/test/encryption/key_manager_test.dart b/test/encryption/key_manager_test.dart index 7f29edd..aba2c34 100644 --- a/test/encryption/key_manager_test.dart +++ b/test/encryption/key_manager_test.dart @@ -215,5 +215,9 @@ void main() { null, true); }); + + test('dispose client', () async { + await client.dispose(closeDatabase: true); + }); }); } diff --git a/test/encryption/key_verification_test.dart b/test/encryption/key_verification_test.dart index 48825f0..1a9ddc9 100644 --- a/test/encryption/key_verification_test.dart +++ b/test/encryption/key_verification_test.dart @@ -99,5 +99,9 @@ void main() { expect(verified, true); keyVerification?.dispose(); }); + + test('dispose client', () async { + await client.dispose(closeDatabase: true); + }); }); } diff --git a/test/encryption/olm_manager_test.dart b/test/encryption/olm_manager_test.dart index 65c10d1..047d0ec 100644 --- a/test/encryption/olm_manager_test.dart +++ b/test/encryption/olm_manager_test.dart @@ -108,5 +108,9 @@ void main() { .containsKey(client.identityKey), true); }); + + test('dispose client', () async { + await client.dispose(closeDatabase: true); + }); }); } diff --git a/test/room_test.dart b/test/room_test.dart index 69000d6..0703e15 100644 --- a/test/room_test.dart +++ b/test/room_test.dart @@ -330,13 +330,13 @@ void main() { final dynamic resp = await room.sendEvent( {'msgtype': 'm.text', 'body': 'hello world'}, txid: 'testtxid'); - expect(resp, '\$event0'); + expect(resp.startsWith('\$event'), true); }); test('sendEvent', () async { final dynamic resp = await room.sendTextEvent('Hello world', txid: 'testtxid'); - expect(resp, '\$event1'); + expect(resp.startsWith('\$event'), true); }); // Not working because there is no real file to test it... diff --git a/test/timeline_test.dart b/test/timeline_test.dart index caf1309..9044a67 100644 --- a/test/timeline_test.dart +++ b/test/timeline_test.dart @@ -143,7 +143,8 @@ void main() { expect(updateCount, 5); expect(insertList, [0, 0, 0]); expect(insertList.length, timeline.events.length); - expect(timeline.events[0].eventId, '\$event0'); + final eventId = timeline.events[0].eventId; + expect(eventId.startsWith('\$event'), true); expect(timeline.events[0].status, 1); client.onEvent.add(EventUpdate( @@ -155,7 +156,7 @@ void main() { 'content': {'msgtype': 'm.text', 'body': 'test'}, 'sender': '@alice:example.com', 'status': 2, - 'event_id': '\$event0', + 'event_id': eventId, 'unsigned': {'transaction_id': '1234'}, 'origin_server_ts': DateTime.now().millisecondsSinceEpoch }, @@ -166,7 +167,7 @@ void main() { expect(updateCount, 6); expect(insertList, [0, 0, 0]); expect(insertList.length, timeline.events.length); - expect(timeline.events[0].eventId, '\$event0'); + expect(timeline.events[0].eventId, eventId); expect(timeline.events[0].status, 2); });