added talk notification levels for chats
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:marianum_mobile/api/marianumcloud/talk/chat/get_chat_response.dart';
|
||||
import 'package:marianum_mobile/api/marianumcloud/talk/room/get_room_response.dart';
|
||||
import 'package:marianum_mobile/api/marianumcloud/talk/room/notification_level.dart';
|
||||
|
||||
typedef Level = GetRoomResponseObjectParticipantNotificationLevel;
|
||||
typedef RoomType = GetRoomResponseObjectConversationType;
|
||||
|
||||
GetRoomResponseObject _room(RoomType type, Level level) =>
|
||||
GetRoomResponseObject(
|
||||
1,
|
||||
't',
|
||||
type,
|
||||
'n',
|
||||
'd',
|
||||
'',
|
||||
3,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
's',
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
0,
|
||||
false,
|
||||
level,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
0,
|
||||
GetChatResponseObject(
|
||||
1,
|
||||
't',
|
||||
GetRoomResponseObjectMessageActorType.user,
|
||||
'a',
|
||||
'A',
|
||||
0,
|
||||
'',
|
||||
GetRoomResponseObjectMessageType.comment,
|
||||
true,
|
||||
'r',
|
||||
'm',
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
);
|
||||
|
||||
void main() {
|
||||
test('Standard wird bei 1:1-Chats zu „Alle Nachrichten"', () {
|
||||
final room = _room(RoomType.oneToOne, Level.defaultLevel);
|
||||
expect(room.effectiveNotificationLevel, Level.alwaysNotify);
|
||||
expect(room.isMuted, isFalse);
|
||||
});
|
||||
|
||||
test('Standard wird bei Gruppen zu „Nur Erwähnungen"', () {
|
||||
expect(
|
||||
_room(RoomType.group, Level.defaultLevel).effectiveNotificationLevel,
|
||||
Level.notifyOnMention,
|
||||
);
|
||||
});
|
||||
|
||||
test('explizit gesetzter Level bleibt erhalten', () {
|
||||
final room = _room(RoomType.oneToOne, Level.neverNotify);
|
||||
expect(room.effectiveNotificationLevel, Level.neverNotify);
|
||||
expect(room.isMuted, isTrue);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user