-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for app state argument #485
Open
navaronbracke
wants to merge
14
commits into
auth0:main
Choose a base branch
from
navaronbracke:app_state_argument
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
345af81
add support for app state argument
navaronbracke 5b62459
update mocks
navaronbracke 21d4717
add test
navaronbracke aff5623
fix type for handle redirect callback; add missing url parameter
navaronbracke 430eda3
add dartify equivalent to js utils
navaronbracke 0ce9619
add app state getter implementation
navaronbracke 78d0140
set the app state that s returned from handle redirect callback
navaronbracke 8cd51f3
add app state getter to public API
navaronbracke 594cabe
update mocks
navaronbracke 6439b38
add more tests
navaronbracke ba9e026
fix typo
navaronbracke eb66057
fix default argument
navaronbracke 0b69944
fix test
navaronbracke 088c8c5
omit argument when not provided
navaronbracke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -8,6 +8,7 @@ import 'package:auth0_flutter/src/web/auth0_flutter_plugin_real.dart'; | |
import 'package:auth0_flutter/src/web/auth0_flutter_web_platform_proxy.dart'; | ||
import 'package:auth0_flutter/src/web/js_interop.dart' as interop; | ||
import 'package:auth0_flutter_platform_interface/auth0_flutter_platform_interface.dart'; | ||
import 'package:collection/collection.dart'; | ||
import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:mockito/annotations.dart'; | ||
|
@@ -160,6 +161,32 @@ void main() { | |
expect(params.max_age, null); | ||
}); | ||
|
||
test('loginWithRedirect supports appState parameter', () async { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New test to verify behavior of the app state |
||
when(mockClientProxy.isAuthenticated()) | ||
.thenAnswer((final _) => Future.value(false)); | ||
|
||
final Map<String, Object?> appState = <String, Object?>{ | ||
'someFancyState': 'value', | ||
}; | ||
|
||
await auth0.loginWithRedirect( | ||
appState: appState, | ||
); | ||
|
||
final params = | ||
verify(mockClientProxy.loginWithRedirect(captureAny)).captured.first; | ||
|
||
final Object? capturedAppState = dartify(params.appState); | ||
|
||
expect(capturedAppState, isNotNull); | ||
expect(capturedAppState, isA<Map<Object?, Object?>>()); | ||
capturedAppState as Map<Object?, Object?>; | ||
|
||
const MapEquality<Object?, Object?> eq = MapEquality<Object?, Object?>(); | ||
|
||
expect(eq.equals(capturedAppState, appState), isTrue); | ||
}); | ||
|
||
test('hasValidCredentials is called without authenticated user', () async { | ||
when(mockClientProxy.isAuthenticated()) | ||
.thenAnswer((final _) => Future.value(false)); | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the
MapEquality
in the test, hence a dev dependency