added guardian login with views for their assigned childs
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:marianum_mobile/access/user_role.dart';
|
||||
import 'package:marianum_mobile/state/app/modules/capabilities/bloc/capabilities_state.dart';
|
||||
|
||||
void main() {
|
||||
test('parses the server wire values', () {
|
||||
expect(UserRole.parse('STUDENT'), UserRole.student);
|
||||
expect(UserRole.parse('TEACHER'), UserRole.teacher);
|
||||
expect(UserRole.parse('STAFF'), UserRole.staff);
|
||||
expect(UserRole.parse('PARENT'), UserRole.parent);
|
||||
});
|
||||
|
||||
test('missing or unknown values are unknown, never an error', () {
|
||||
expect(UserRole.parse(null), UserRole.unknown);
|
||||
expect(UserRole.parse('ALUMNUS'), UserRole.unknown);
|
||||
});
|
||||
|
||||
test('hydrated capability states from older versions stay readable', () {
|
||||
final state = CapabilitiesState.fromJson({
|
||||
'viewForeignTimetables': true,
|
||||
'pushNotifications': true,
|
||||
'userType': 'TEACHER',
|
||||
'loaded': true,
|
||||
});
|
||||
expect(state.role, UserRole.teacher);
|
||||
expect(CapabilitiesState.fromJson({}).role, UserRole.unknown);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user