From 5343cb8fcaf753d1c0e97c1f7d853fe2fb6bec5d Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Wed, 12 Jun 2019 08:40:43 +0200 Subject: [PATCH] Fix Room Tests --- test/Room_test.dart | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/test/Room_test.dart b/test/Room_test.dart index a9649a5..2b1b3e3 100644 --- a/test/Room_test.dart +++ b/test/Room_test.dart @@ -30,7 +30,6 @@ import 'FakeMatrixApi.dart'; void main() { /// All Tests related to the Event group("Room", () { - Client matrix = Client("testclient"); matrix.connection.httpClient = FakeMatrixApi(); matrix.homeserver = "https://fakeServer.notExisting"; @@ -53,6 +52,11 @@ void main() { final String historyVisibility = "invite"; final String joinRules = "invite"; final int now = DateTime.now().millisecondsSinceEpoch; + final String msgtype = "m.text"; + final String body = "Hello World"; + final String formatted_body = "Hello World"; + final String contentJson = + '{"msgtype":"$msgtype","body":"$body","formatted_body":"$formatted_body"}'; final Map jsonObj = { "id": id, @@ -83,32 +87,31 @@ void main() { "power_event_aliases": 0, "power_event_name": 0, "power_event_power_levels": 0, + "content_json": contentJson, }; room = await Room.getRoomFromTableRow(jsonObj, matrix); - expect(room.id,id); - expect(room.name,name); - expect(room.topic,topic); - expect(room.avatar.mxc,""); - expect(room.notificationCount,notificationCount); - expect(room.highlightCount,highlightCount); - expect(room.unread.toTimeStamp(),unread); - expect(room.fullyRead,fullyRead); - expect(room.notificationSettings,notificationSettings); - expect(room.directChatMatrixID,""); - expect(room.draft,""); - expect(room.prev_batch,""); - expect(room.guestAccess,guestAccess); - expect(room.historyVisibility,historyVisibility); - expect(room.joinRules,joinRules); - expect(room.lastMessage,""); + expect(room.id, id); + expect(room.name, name); + expect(room.topic, topic); + expect(room.avatar.mxc, ""); + expect(room.notificationCount, notificationCount); + expect(room.highlightCount, highlightCount); + expect(room.unread.toTimeStamp(), unread); + expect(room.fullyRead, fullyRead); + expect(room.notificationSettings, notificationSettings); + expect(room.directChatMatrixID, ""); + expect(room.draft, ""); + expect(room.prev_batch, ""); + expect(room.guestAccess, guestAccess); + expect(room.historyVisibility, historyVisibility); + expect(room.joinRules, joinRules); + expect(room.lastMessage, "Hello World"); expect(room.timeCreated.toTimeStamp() >= now, true); room.powerLevels.forEach((String key, int value) { expect(value, 0); }); - }); - }); }