implemented dual Nextcloud push registration with separate general and talk apptypes to ensure reliable Talk notification delivery; introduced stacked MessagingStyle notifications for chat threads with support for circular conversation avatars and disk caching
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:marianum_mobile/push/push_subject.dart';
|
||||
|
||||
void main() {
|
||||
group('parseTalkSubject', () {
|
||||
test('1:1 chat: "{user}\\n{message}"', () {
|
||||
final parsed = parseTalkSubject('Max Mustermann\nHallo zusammen');
|
||||
expect(parsed.sender, 'Max Mustermann');
|
||||
expect(parsed.roomName, isNull);
|
||||
expect(parsed.text, 'Hallo zusammen');
|
||||
});
|
||||
|
||||
test('group chat: "{user} in {call}\\n{message}" (de identical)', () {
|
||||
final parsed = parseTalkSubject('Max in Projektraum\nHallo');
|
||||
expect(parsed.sender, 'Max');
|
||||
expect(parsed.roomName, 'Projektraum');
|
||||
expect(parsed.text, 'Hallo');
|
||||
});
|
||||
|
||||
test('sender containing " in " splits at the LAST separator', () {
|
||||
final parsed = parseTalkSubject('Max in the Middle in Raum X\nHi');
|
||||
expect(parsed.sender, 'Max in the Middle');
|
||||
expect(parsed.roomName, 'Raum X');
|
||||
expect(parsed.text, 'Hi');
|
||||
});
|
||||
|
||||
test('legacy ": " separator still works as fallback', () {
|
||||
final parsed = parseTalkSubject('Max: Hallo');
|
||||
expect(parsed.sender, 'Max');
|
||||
expect(parsed.roomName, isNull);
|
||||
expect(parsed.text, 'Hallo');
|
||||
});
|
||||
|
||||
test('legacy group form "Sender in Raum: msg"', () {
|
||||
final parsed = parseTalkSubject('Max in Raum: Hallo');
|
||||
expect(parsed.sender, 'Max');
|
||||
expect(parsed.roomName, 'Raum');
|
||||
expect(parsed.text, 'Hallo');
|
||||
});
|
||||
|
||||
test('no separator falls back to a generic sender', () {
|
||||
final parsed = parseTalkSubject(
|
||||
'Max hat eine Nachricht in der Unterhaltung Raum gesendet',
|
||||
);
|
||||
expect(parsed.sender, 'Talk');
|
||||
expect(parsed.roomName, isNull);
|
||||
expect(
|
||||
parsed.text,
|
||||
'Max hat eine Nachricht in der Unterhaltung Raum gesendet',
|
||||
);
|
||||
});
|
||||
|
||||
test('multiline message keeps newlines after the first', () {
|
||||
final parsed = parseTalkSubject('Max\nZeile 1\nZeile 2');
|
||||
expect(parsed.sender, 'Max');
|
||||
expect(parsed.text, 'Zeile 1\nZeile 2');
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user