refactored broad range of the application, split files, modularized calendar and file views, centralized bottom sheets and clipboard handling, and implemented unit test coverage

This commit is contained in:
2026-05-08 19:05:16 +02:00
parent 3b1b0d0c19
commit c62a14645a
68 changed files with 4633 additions and 3141 deletions
@@ -0,0 +1,76 @@
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/chat/rich_object_string_processor.dart';
RichObjectString _r(String name, {RichObjectStringObjectType type = RichObjectStringObjectType.user}) =>
RichObjectString(type, 'id-$name', name, null, null);
void main() {
group('RichObjectStringProcessor.parseToString', () {
test('null data returns the message unchanged', () {
expect(
RichObjectStringProcessor.parseToString('Hallo {actor}', null),
'Hallo {actor}',
);
});
test('substitutes a single placeholder by .name', () {
expect(
RichObjectStringProcessor.parseToString(
'{actor} hat eine Datei geteilt',
{'actor': _r('Elias')},
),
'Elias hat eine Datei geteilt',
);
});
test('substitutes multiple placeholders independently', () {
expect(
RichObjectStringProcessor.parseToString(
'{actor} hat {file} mit {target} geteilt',
{
'actor': _r('Elias'),
'file': _r('foo.pdf', type: RichObjectStringObjectType.file),
'target': _r('Klasse 11a', type: RichObjectStringObjectType.group),
},
),
'Elias hat foo.pdf mit Klasse 11a geteilt',
);
});
test('replaces every occurrence of the same placeholder', () {
expect(
RichObjectStringProcessor.parseToString(
'{actor} {actor} {actor}',
{'actor': _r('A')},
),
'A A A',
);
});
test('placeholders with no matching key remain unchanged', () {
expect(
RichObjectStringProcessor.parseToString(
'{actor} sah {file}',
{'actor': _r('Elias')},
),
'Elias sah {file}',
);
});
test('empty data map returns the message unchanged', () {
expect(
RichObjectStringProcessor.parseToString('Hallo {actor}', const {}),
'Hallo {actor}',
);
});
test('messages without placeholders are returned verbatim', () {
expect(
RichObjectStringProcessor.parseToString('reine Textnachricht',
{'actor': _r('A')}),
'reine Textnachricht',
);
});
});
}