forked from firebase/flutterfire
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[firebase_auth_web] Add null check to _fromJsUser. (firebase#1798)
* Added unit test for the onAuthStateChanged stream (from JS). * Migrate tests from jsify to package:js * Update version and CHANGELOG Fixes firebase#1685
- Loading branch information
Showing
5 changed files
with
180 additions
and
39 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
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
96 changes: 96 additions & 0 deletions
96
packages/firebase_auth/firebase_auth_web/test/mock/firebase_mock.dart
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,96 @@ | ||
@JS() | ||
library firebase_mock; | ||
|
||
import 'package:js/js.dart'; | ||
|
||
@JS() | ||
@anonymous | ||
class FirebaseAppOptionsMock { | ||
external factory FirebaseAppOptionsMock({String appId}); | ||
external String get appId; | ||
} | ||
|
||
@JS() | ||
@anonymous | ||
class FirebaseAppMock { | ||
external factory FirebaseAppMock({ | ||
String name, | ||
FirebaseAppOptionsMock options, | ||
}); | ||
external String get name; | ||
external FirebaseAppOptionsMock get options; | ||
} | ||
|
||
@JS() | ||
@anonymous | ||
class FirebaseAuthMock { | ||
external factory FirebaseAuthMock({ | ||
Function signInAnonymously, | ||
Function onAuthStateChanged, | ||
}); | ||
external Function get signInAnonymously; | ||
external Function get onAuthStateChanged; | ||
} | ||
|
||
@JS() | ||
@anonymous | ||
class FirebaseMock { | ||
external factory FirebaseMock({Function app}); | ||
external Function get app; | ||
|
||
external set auth(Function auth); | ||
external Function get auth; | ||
} | ||
|
||
@JS() | ||
class Promise<T> { | ||
external Promise(void executor(void resolve(T result), Function reject)); | ||
external Promise then(void onFulfilled(T result), [Function onRejected]); | ||
} | ||
|
||
@JS() | ||
@anonymous | ||
class MockUserMetadata { | ||
external factory MockUserMetadata({ | ||
String creationTime, | ||
String lastSignInTime, | ||
}); | ||
external String get creationTime; | ||
external String get lastSignInTime; | ||
} | ||
|
||
@JS() | ||
@anonymous | ||
class MockUser { | ||
external factory MockUser({ | ||
String providerId, | ||
MockUserMetadata metadata, | ||
List providerData, | ||
}); | ||
external String get providerId; | ||
external MockUserMetadata get metadata; | ||
external List get providerData; | ||
} | ||
|
||
@JS() | ||
@anonymous | ||
class MockAdditionalUserInfo { | ||
external factory MockAdditionalUserInfo(); | ||
} | ||
|
||
@JS() | ||
@anonymous | ||
class MockUserCredential { | ||
external factory MockUserCredential({ | ||
MockUser user, | ||
MockAdditionalUserInfo additionalUserInfo, | ||
}); | ||
external MockUser get user; | ||
external MockAdditionalUserInfo get additionalUserInfo; | ||
} | ||
|
||
// Wire to the global 'window.firebase' object. | ||
@JS('firebase') | ||
external set firebaseMock(FirebaseMock mock); | ||
@JS('firebase') | ||
external FirebaseMock get firebaseMock; |