dart format

This commit is contained in:
2026-05-08 20:12:40 +02:00
parent 9e139b5704
commit 3b8da1d3d6
295 changed files with 6404 additions and 4161 deletions
+25 -12
View File
@@ -22,18 +22,27 @@ void main() {
});
test('SocketException maps to NetworkException message', () {
expect(errorToUserMessage(const SocketException('boom')),
const NetworkException().userMessage);
expect(
errorToUserMessage(const SocketException('boom')),
const NetworkException().userMessage,
);
});
test('TimeoutException maps to the timeout-specific NetworkException message', () {
expect(errorToUserMessage(TimeoutException('slow')),
NetworkException.timeout().userMessage);
});
test(
'TimeoutException maps to the timeout-specific NetworkException message',
() {
expect(
errorToUserMessage(TimeoutException('slow')),
NetworkException.timeout().userMessage,
);
},
);
test('http.ClientException maps to NetworkException message', () {
expect(errorToUserMessage(http.ClientException('failed')),
const NetworkException().userMessage);
expect(
errorToUserMessage(http.ClientException('failed')),
const NetworkException().userMessage,
);
});
test('HandshakeException maps to a TLS-specific message', () {
@@ -43,8 +52,10 @@ void main() {
});
test('FormatException maps to ParseException message', () {
expect(errorToUserMessage(const FormatException('bad json')),
const ParseException().userMessage);
expect(
errorToUserMessage(const FormatException('bad json')),
const ParseException().userMessage,
);
});
test('ApiError surfaces only the first line of its message', () {
@@ -58,8 +69,10 @@ void main() {
});
test('unknown error type falls back', () {
expect(errorToUserMessage(StateError('weird')),
contains('Etwas ist schiefgelaufen'));
expect(
errorToUserMessage(StateError('weird')),
contains('Etwas ist schiefgelaufen'),
);
});
test('custom fallback overrides the default', () {
@@ -2,8 +2,10 @@ 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);
RichObjectString _r(
String name, {
RichObjectStringObjectType type = RichObjectStringObjectType.user,
}) => RichObjectString(type, 'id-$name', name, null, null);
void main() {
group('RichObjectStringProcessor.parseToString', () {
@@ -40,20 +42,18 @@ void main() {
test('replaces every occurrence of the same placeholder', () {
expect(
RichObjectStringProcessor.parseToString(
'{actor} {actor} {actor}',
{'actor': _r('A')},
),
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')},
),
RichObjectStringProcessor.parseToString('{actor} sah {file}', {
'actor': _r('Elias'),
}),
'Elias sah {file}',
);
});
@@ -67,8 +67,9 @@ void main() {
test('messages without placeholders are returned verbatim', () {
expect(
RichObjectStringProcessor.parseToString('reine Textnachricht',
{'actor': _r('A')}),
RichObjectStringProcessor.parseToString('reine Textnachricht', {
'actor': _r('A'),
}),
'reine Textnachricht',
);
});
+26 -13
View File
@@ -7,13 +7,12 @@ import 'package:marianum_mobile/state/app/modules/timetable/bloc/timetable_state
TimetableState _state({
Set<GetSubjectsResponseObject> subjects = const {},
Set<GetRoomsResponseObject> rooms = const {},
}) =>
TimetableState(
subjects: subjects.isEmpty ? null : GetSubjectsResponse(subjects),
rooms: rooms.isEmpty ? null : GetRoomsResponse(rooms),
startDate: DateTime(2026, 1, 1),
endDate: DateTime(2026, 12, 31),
);
}) => TimetableState(
subjects: subjects.isEmpty ? null : GetSubjectsResponse(subjects),
rooms: rooms.isEmpty ? null : GetRoomsResponse(rooms),
startDate: DateTime(2026, 1, 1),
endDate: DateTime(2026, 12, 31),
);
void main() {
group('LessonResolver.resolveSubject', () {
@@ -47,7 +46,13 @@ void main() {
group('LessonResolver.resolveRoom', () {
test('returns the matching room when the id is found', () {
final room = GetRoomsResponseObject(3, 'A1', 'Aula 1', true, 'Hauptgebäude');
final room = GetRoomsResponseObject(
3,
'A1',
'Aula 1',
true,
'Hauptgebäude',
);
final state = _state(rooms: {room});
final result = LessonResolver.resolveRoom(state, 3);
@@ -66,10 +71,14 @@ void main() {
group('LessonFormatter', () {
test('iconForCode picks the right icon per status', () {
expect(LessonFormatter.iconForCode('cancelled').codePoint,
isNot(LessonFormatter.iconForCode('irregular').codePoint));
expect(LessonFormatter.iconForCode(null).codePoint,
isNot(LessonFormatter.iconForCode('cancelled').codePoint));
expect(
LessonFormatter.iconForCode('cancelled').codePoint,
isNot(LessonFormatter.iconForCode('irregular').codePoint),
);
expect(
LessonFormatter.iconForCode(null).codePoint,
isNot(LessonFormatter.iconForCode('cancelled').codePoint),
);
});
test('statusLabel maps known codes to German labels', () {
@@ -88,7 +97,11 @@ void main() {
test('formatLine renders name + (longname) + · extra in that order', () {
expect(
LessonFormatter.formatLine('Mathe', longname: 'Mathematik', extra: 'Hauptgebäude'),
LessonFormatter.formatLine(
'Mathe',
longname: 'Mathematik',
extra: 'Hauptgebäude',
),
'Mathe (Mathematik) · Hauptgebäude',
);
});