chore: addressed review feedback

pull/226/head
Jonathan Daniels 3 years ago
parent 3431477a22
commit 8075457b91

@ -180,13 +180,9 @@ class LeaderboardRepository {
.collection('prohibitedInitials') .collection('prohibitedInitials')
.doc('list') .doc('list')
.get(); .get();
final prohibitedInitials = List<String>.from( final prohibitedInitials =
document.get('prohibitedInitials') as List, document.get('prohibitedInitials') as List<String>;
); return !prohibitedInitials.contains(initials);
final isProhibited = prohibitedInitials.contains(
initials.trim().toLowerCase(),
);
return !isProhibited;
} on Exception catch (error, stackTrace) { } on Exception catch (error, stackTrace) {
throw FetchProhibitedInitialsException(error, stackTrace); throw FetchProhibitedInitialsException(error, stackTrace);
} }

@ -246,7 +246,7 @@ void main() {
when(() => documentReference.get()) when(() => documentReference.get())
.thenAnswer((_) async => documentSnapshot); .thenAnswer((_) async => documentSnapshot);
when<dynamic>(() => documentSnapshot.get('prohibitedInitials')) when<dynamic>(() => documentSnapshot.get('prohibitedInitials'))
.thenReturn(['bad']); .thenReturn(['BAD']);
}); });
test('returns true if initials are three letters and allowed', () async { test('returns true if initials are three letters and allowed', () async {

Loading…
Cancel
Save