-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85c6fca
commit 072da42
Showing
16 changed files
with
179 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import 'package:bu_passport/classes/user.dart'; | ||
import 'package:bu_passport/pages/leaderboard_page.dart'; | ||
import 'package:cloud_firestore/cloud_firestore.dart'; | ||
import 'package:firebase_core/firebase_core.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
@@ -11,31 +12,35 @@ import 'mock.dart'; | |
void main() { | ||
final List<Users> mockUsers = [ | ||
Users( | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
userBUID: '123456', | ||
userEmail: '[email protected]', | ||
userSchool: 'Example School', | ||
userUID: 'user1', | ||
userYear: 3, | ||
userSavedEvents: {}, | ||
userPoints: 100, | ||
userProfileURL: '', | ||
admin: false, | ||
), | ||
firstName: 'John', | ||
lastName: 'Doe', | ||
userBUID: '123456', | ||
userEmail: '[email protected]', | ||
userSchool: 'Example School', | ||
userUID: 'user1', | ||
userYear: 3, | ||
userSavedEvents: {}, | ||
userPoints: 100, | ||
userProfileURL: '', | ||
userCollectedStickers: {}, | ||
userPhotos: [], | ||
userCreatedAt: Timestamp.now(), | ||
), | ||
Users( | ||
firstName: 'Jane', | ||
lastName: 'Smith', | ||
userBUID: '654321', | ||
userEmail: '[email protected]', | ||
userSchool: 'Another School', | ||
userUID: 'user2', | ||
userYear: 2, | ||
userSavedEvents: {}, | ||
userPoints: 200, | ||
userProfileURL: '', | ||
admin: false, | ||
), | ||
firstName: 'Jane', | ||
lastName: 'Smith', | ||
userBUID: '654321', | ||
userEmail: '[email protected]', | ||
userSchool: 'Another School', | ||
userUID: 'user2', | ||
userYear: 2, | ||
userSavedEvents: {}, | ||
userPoints: 150, | ||
userProfileURL: '', | ||
userCollectedStickers: {}, | ||
userPhotos: [], | ||
userCreatedAt: Timestamp.now(), | ||
), | ||
]; | ||
MockFirebaseService mockFirebaseService = MockFirebaseService(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,13 +6,14 @@ import 'package:flutter_test/flutter_test.dart'; | |
import 'package:bu_passport/pages/explore_page.dart'; | ||
import 'package:bu_passport/classes/event.dart'; | ||
import 'package:mockito/mockito.dart'; | ||
|
||
import 'event_widget_test.mocks.dart'; | ||
import 'mock.dart'; | ||
|
||
// Not set up to verify the sign in process, just the state of the page | ||
|
||
void main() { | ||
MockFirebaseService mockFirebaseService = MockFirebaseService(); | ||
|
||
setupFirebaseAuthMocks(); | ||
|
||
setUpAll(() async { | ||
|
@@ -23,19 +24,8 @@ void main() { | |
await tester.pumpWidget(MaterialApp( | ||
home: LoginPage(), | ||
)); | ||
expect(find.text('Email'), findsOneWidget); | ||
expect(find.text('Password'), findsOneWidget); | ||
expect(find.text('Sign In'), findsOneWidget); | ||
expect(find.text("Don't have an account?"), findsOneWidget); | ||
expect(find.text('Sign Up'), findsOneWidget); | ||
|
||
// Enter test email and password | ||
await tester.enterText(find.byType(TextField).at(0), '[email protected]'); | ||
await tester.enterText(find.byType(TextField).at(1), 'password'); | ||
|
||
// Tap the sign in button | ||
await tester.tap(find.text('Sign In')); | ||
await tester.tap(find.text('Sign In with BU Gmail')); | ||
await tester.pump(); | ||
|
||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'package:mockito/mockito.dart'; | ||
import 'package:cloud_firestore/cloud_firestore.dart'; | ||
import 'package:firebase_auth/firebase_auth.dart'; | ||
|
||
class MockFirestore extends Mock implements FirebaseFirestore {} | ||
|
||
class MockFirebaseAuth extends Mock implements FirebaseAuth {} | ||
|
||
class MockUser extends Mock implements User {} | ||
|
||
class MockDocumentSnapshot { | ||
final Map<String, dynamic> mockData; | ||
|
||
MockDocumentSnapshot(this.mockData); | ||
|
||
@override | ||
Map<String, dynamic>? data() { | ||
return mockData; | ||
} | ||
|
||
@override | ||
bool get exists => data()?.isNotEmpty ?? false; | ||
} |
Oops, something went wrong.