-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! TF-3278 Handle open app via deep link at MailboxDashboard screen
- Loading branch information
Showing
2 changed files
with
32 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,8 @@ void main() { | |
final deepLinkManager = DeepLinksManager(mockAutoSignInViaDeepLinkInteractor); | ||
|
||
group('DeepLinksManager::parseDeepLink::test', () { | ||
test('Valid deep link with multiple query parameters', () { | ||
const deepLink = 'twake.mail://openApp?access_token=ey123456&refresh_token=ey7890&id_token=token&expires_in=3600&[email protected]'; | ||
test('SHOULD parse valid URL with all parameters', () { | ||
const url = 'twake.mail://openApp?access_token=ey123456&refresh_token=ey7890&id_token=token&expires_in=3600&[email protected]'; | ||
final expectedData = DeepLinkData( | ||
action: 'openapp', | ||
accessToken: 'ey123456', | ||
|
@@ -21,31 +21,48 @@ void main() { | |
expiresIn: 3600, | ||
username: '[email protected]', | ||
); | ||
final deepLinkData = deepLinkManager.parseDeepLink(deepLink); | ||
final deepLinkData = deepLinkManager.parseDeepLink(url); | ||
|
||
expect(deepLinkData, equals(expectedData)); | ||
}); | ||
|
||
test('Deep link with no query parameters', () { | ||
const deepLink = 'twake.mail://openApp'; | ||
test('SHOULD handle URL with missing parameters', () { | ||
const url = 'twake.mail://openApp'; | ||
final expectedData = DeepLinkData(action: 'openapp'); | ||
final deepLinkData = deepLinkManager.parseDeepLink(deepLink); | ||
final deepLinkData = deepLinkManager.parseDeepLink(url); | ||
|
||
expect(deepLinkData, expectedData); | ||
}); | ||
|
||
test('Deep link with one query parameter', () { | ||
const deepLink = 'twake.mail://openApp?access_token=ey123456'; | ||
test('SHOULD parse valid URL with one query parameter', () { | ||
const url = 'twake.mail://openApp?access_token=ey123456'; | ||
final expectedData = DeepLinkData(action: 'openapp', accessToken: 'ey123456',); | ||
final deepLinkData = deepLinkManager.parseDeepLink(deepLink); | ||
final deepLinkData = deepLinkManager.parseDeepLink(url); | ||
|
||
expect(deepLinkData, equals(expectedData)); | ||
}); | ||
|
||
test('Invalid deep link format', () { | ||
const deepLink = 'Invalid link: invalid'; | ||
final deepLinkData = deepLinkManager.parseDeepLink(deepLink); | ||
test('SHOULD return null for an invalid URL', () { | ||
const url = 'Invalid link: invalid'; | ||
final deepLinkData = deepLinkManager.parseDeepLink(url); | ||
expect(deepLinkData, isNull); | ||
}); | ||
|
||
test('SHOULD decode encoded URL correctly', () { | ||
const encodedUrl = 'twake.mail://openApp?access_token=abc%20123&username=test%20user'; | ||
final result = deepLinkManager.parseDeepLink(encodedUrl); | ||
|
||
expect(result, isNotNull); | ||
expect(result!.accessToken, 'abc 123'); | ||
expect(result.username, 'test user'); | ||
}); | ||
|
||
test('SHOULD return null WHEN Uri.decodeFull throws an exception', () { | ||
const invalidUrl = 'twake-workplace://login?access_token=%ZZ'; | ||
|
||
final result = deepLinkManager.parseDeepLink(invalidUrl); | ||
|
||
expect(result, isNull); | ||
}); | ||
}); | ||
} |