-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2161 from acterglobal/kumar/general-fixes
Add Link : Fixes issue related to url prefix
- Loading branch information
Showing
3 changed files
with
52 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import 'package:acter/common/utils/utils.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
void main() { | ||
group('URL Validation Tests', () { | ||
test('Valid URL with http', () { | ||
expect(isValidUrl('http://example.com'), true); | ||
}); | ||
|
||
test('Valid URL with https', () { | ||
expect(isValidUrl('https://example.com'), true); | ||
}); | ||
|
||
test('Valid URL with custom schema', () { | ||
expect(isValidUrl('custom://example.com'), true); | ||
}); | ||
|
||
test('Valid URL with subdomains', () { | ||
expect(isValidUrl('https://sub.example.com'), true); | ||
}); | ||
|
||
test('Valid URL with query parameters', () { | ||
expect(isValidUrl('https://example.com?query=flutter'), true); | ||
}); | ||
|
||
test('Invalid URL without scheme', () { | ||
expect(isValidUrl('example.com'), false); | ||
}); | ||
|
||
test('Invalid URL with invalid characters', () { | ||
expect(isValidUrl('https://example!.com'), false); | ||
}); | ||
|
||
test('Invalid URL with missing domain', () { | ||
expect(isValidUrl('https://.com'), false); | ||
}); | ||
|
||
test('Empty URL string', () { | ||
expect(isValidUrl(''), false); | ||
}); | ||
}); | ||
} |